Resources Numerical accuracy
Calculations
Every calculation under our calculation policies: what it works out, its formula and the precision it runs at. Open one to see its code as it is in the released app.
Calculations
-
Length a bar takes
The length of bar used by a set of pieces, with the saw kerf and the saving when mitred ends share a cut.
used = Σ (length + kerf) − depth × min(⌊mitred ends ÷ 2⌋, mitred pieces − 1)
Cutting profile pieces from stock bars addons/windows/lib/cutlist/bars.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Fewest bars for one stock length
Which pieces go on which bar, and whether the count is proven to be the fewest.
bound = ⌈Σ (length + kerf) ÷ usable − 1e-9⌉; usable = stock − trim at both ends
Cutting profile pieces from stock bars addons/windows/lib/cutlist/bars.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Bars, cut positions, offcuts and waste
The list of bars with each piece's start position, the offcut left on each bar and the totals.
pos accumulates length + kerf; offcut = stock − trims − used; waste % = round((1 − piece length ÷ stock length) × 10⁴) ÷ 100
Cutting profile pieces from stock bars addons/windows/lib/cutlist/bars.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Totals over all profiles
The number of bars, the piece length, the stock length and the waste over every profile and color.
waste = Σ stock length − Σ piece length
Cutting profile pieces from stock bars addons/windows/lib/cutlist/bars.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Raw double, read
A 64-bit value read from eight bytes of the bit stream.
Numbers in a DWG file, read and written bit for bit dwg/bits-read.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Bit double, read
A value stored as a two-bit code: a full 64-bit value, exactly 1.0 or exactly 0.0.
Numbers in a DWG file, read and written bit for bit dwg/bits-read.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Double with default, read
A value stored as the bytes in which it differs from a default value.
Numbers in a DWG file, read and written bit for bit dwg/bits-read.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
64-bit whole number, read
An unsigned 64-bit whole number from two 32-bit halves.
value = high × 2³² + low
Numbers in a DWG file, read and written bit for bit dwg/bits-read.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Bit long long, read
A whole number of up to seven bytes, the count given by three bits.
value = Σ byteᵢ × 256ⁱ
Numbers in a DWG file, read and written bit for bit dwg/bits-read.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Handle reference, read
An object handle, absolute or as an offset from another handle.
value = Σ byte × 256ᵏ; codes 6, 8, A, C: ref + 1, ref − 1, ref + value, ref − value
Numbers in a DWG file, read and written bit for bit dwg/bits-read.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Modular char, read
A signed whole number stored seven bits per byte.
value = Σ (byte & 0x7F) × 2^(7i); the last byte carries 6 bits and the sign
Numbers in a DWG file, read and written bit for bit dwg/bits-read.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Raw double, written
A 64-bit value written as its eight bytes.
Numbers in a DWG file, read and written bit for bit dwg/bits-write.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Bit double, written
A value written as a two-bit code for exactly 0.0 or 1.0, or as a full 64-bit value.
Numbers in a DWG file, read and written bit for bit dwg/bits-write.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Double with default, written
A value written as a two-bit code when it equals its default, or in full.
Numbers in a DWG file, read and written bit for bit dwg/bits-write.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Thickness, written
A thickness written as one bit when it is zero, or as a bit double.
Numbers in a DWG file, read and written bit for bit dwg/bits-write.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Bit long, written
A 32-bit whole number in its short or full form.
Numbers in a DWG file, read and written bit for bit dwg/bits-write.jsExact- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Bit short, written
A 16-bit whole number in its short or full form.
Numbers in a DWG file, read and written bit for bit dwg/bits-write.jsExact- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Bit long long, written
A 64-bit whole number as a three-bit byte count and its bytes.
Numbers in a DWG file, read and written bit for bit dwg/bits-write.jsExact- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Point, written
The three coordinates of a point as bit doubles.
Numbers in a DWG file, read and written bit for bit dwg/bits-write.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Handle bytes, written
A handle as its bytes, most significant first.
byte = v mod 256; v = ⌊v ÷ 256⌋
Numbers in a DWG file, read and written bit for bit dwg/bits-write.jsExact- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Lineweight to stored index
The index written for a lineweight, or the codes for by layer, by block and default.
index of the list value with the smallest |value − lineweight|
Lineweights in a DWG file dwg/model.jsExact- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
-
Stored index to lineweight
The lineweight for an index read from a file.
Lineweights in a DWG file dwg/model.jsExact- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
-
Longest clear part of a move
The part of a straight move that stays clear of other solids.
steps = min(160, max(4, ⌈|δ| ÷ (thin ÷ 2)⌉)); then 24 halvings between the last clear and the first blocked sample
Where a moved solid stops against another m3d/collide.js64-bit- CadCraft
- ModelCraft
-
Thinnest dimension
The smallest box side of the moving pieces and of everything in the way, which sets the sample spacing.
thin = max(0.005, min over boxes of the smallest side above 1e-4)
Where a moved solid stops against another m3d/collide.js64-bit- CadCraft
- ModelCraft
-
Edge through the inside of a face
Whether a segment passes through a face's interior.
sₚ = n·p − d, s_q = n·q − d; t = sₚ ÷ (sₚ − s_q)
Where a moved solid stops against another m3d/collide.js64-bit- CadCraft
- ModelCraft
-
Point in a face
Whether a point on a face's plane lies in one of its triangles.
u, v from cross products ÷ |n|²; inside when u, v, 1 − u − v ≥ −1e-9
Where a moved solid stops against another m3d/collide.js64-bit- CadCraft
- ModelCraft
-
Point inside a solid
Whether a point lies inside the closed surface made of an object's faces.
Where a moved solid stops against another m3d/collide.js64-bit- CadCraft
- ModelCraft
-
Ray against a triangle
The distance along a ray to a triangle, or nothing when it misses.
det = e₁·(d × e₂); u = (s·(d × e₂)) ÷ det; v = (d·(s × e₁)) ÷ det; t = (e₂·(s × e₁)) ÷ det
Where a moved solid stops against another m3d/collide.js64-bit- CadCraft
- ModelCraft
-
Box of a placed component
The bounding box in the model of a component's faces and edges, from its own coordinates and its placement matrix.
X = (m₀x + m₄y + m₈z + m₁₂) ÷ w
Where a moved solid stops against another m3d/collide.js64-bit- CadCraft
- ModelCraft
-
Triangles of a polygon with holes
The triangles of a face as triples of vertex indexes.
Triangulation of faces with holes m3d/earcut.js64-bit- CadCraft
- ModelCraft
- TakeoffCraft
-
Orientation of three points
Twice the signed area of a triangle, whose sign says which way three points turn.
(q_y − p_y)(r_x − q_x) − (q_x − p_x)(r_y − q_y)
Triangulation of faces with holes m3d/earcut.js64-bit- CadCraft
- ModelCraft
- TakeoffCraft
-
Direction of a ring
Whether a ring of points runs clockwise or counterclockwise.
Σ (x_j − x_i)(y_i + y_j)
Triangulation of faces with holes m3d/earcut.js64-bit- CadCraft
- ModelCraft
- TakeoffCraft
-
Is a corner an ear
Whether the triangle at a corner is convex and holds no other point of the polygon.
Triangulation of faces with holes m3d/earcut.js64-bit- CadCraft
- ModelCraft
- TakeoffCraft
-
Point in a triangle
Whether a point lies in or on a triangle.
three comparisons (c − p) × (a − p) ≥ 0, each written as product ≥ product
Triangulation of faces with holes m3d/earcut.js64-bit- CadCraft
- ModelCraft
- TakeoffCraft
-
Duplicate and collinear points removed
Drops points that repeat their neighbor or lie exactly on the line between their neighbors.
Triangulation of faces with holes m3d/earcut.js64-bit- CadCraft
- ModelCraft
- TakeoffCraft
-
Bridge from a hole to the outer ring
The outer-ring point a hole is connected to, found by a ray to the left from the hole's leftmost point.
x = p_x + (h_y − p_y)(n_x − p_x) ÷ (n_y − p_y); tan = |h_y − p_y| ÷ (h_x − p_x)
Triangulation of faces with holes m3d/earcut.js64-bit- CadCraft
- ModelCraft
- TakeoffCraft
-
Do two edges cross
Whether two segments intersect, used to keep a diagonal from crossing the polygon.
Triangulation of faces with holes m3d/earcut.js64-bit- CadCraft
- ModelCraft
- TakeoffCraft
-
Is a diagonal's midpoint inside
Whether the middle of a candidate diagonal lies inside the polygon.
crossing count of a ray from ((a_x + b_x) ÷ 2, (a_y + b_y) ÷ 2)
Triangulation of faces with holes m3d/earcut.js64-bit- CadCraft
- ModelCraft
- TakeoffCraft
-
Rational tag value
A TIFF RATIONAL (two 32-bit integers) as one number.
value = numerator ÷ denominator
TIFF scan resolution raster/tiff.js64-bit- CadCraft
- BimCraft
- ModelCraft
- CivilCraft
- PartCraft
-
Resolution in dots per inch
The horizontal and vertical resolution of a page, in dots per inch.
dpi = resolution × 2.54 (centimeter files); dpi = resolution (inch files)
TIFF scan resolution raster/tiff.js64-bit- CadCraft
- BimCraft
- ModelCraft
- CivilCraft
- PartCraft
-
Triangulate a polygon with holes
The triangles of a polygon, as indexes into its point list.
Polygon triangulation (ear clipping) usd/earcut.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Winding of a ring
Whether a ring runs clockwise or counterclockwise.
sum = Σ (xⱼ − xᵢ) × (yᵢ + yⱼ)
Polygon triangulation (ear clipping) usd/earcut.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Orientation of three points
On which side of the line through two points a third point lies.
area = (q.y − p.y) × (r.x − q.x) − (q.x − p.x) × (r.y − q.y)
Polygon triangulation (ear clipping) usd/earcut.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Removing duplicate and collinear points
Drops points that repeat their neighbor or lie on the line between their neighbors.
Polygon triangulation (ear clipping) usd/earcut.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Ear test
Whether a corner can be cut off as a triangle: it is convex and no other point of the ring lies inside it.
Polygon triangulation (ear clipping) usd/earcut.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Point in triangle
Whether a point lies inside or on a triangle.
three cross products of (corner − point) pairs, each ≥ 0
Polygon triangulation (ear clipping) usd/earcut.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Bridge from a hole to the outer ring
The point of the outer ring a hole is connected to.
x = p.x + (h.y − p.y) × (p′.x − p.x) ÷ (p′.y − p.y); tan = |h.y − p.y| ÷ (h.x − p.x)
Polygon triangulation (ear clipping) usd/earcut.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Do two segments cross
Whether two edges intersect, including touching and collinear overlap.
Polygon triangulation (ear clipping) usd/earcut.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Is the middle of a diagonal inside the polygon
Whether a diagonal between two corners runs through the inside of the polygon.
midpoint = ((a.x + b.x) ÷ 2, (a.y + b.y) ÷ 2); even-odd count of edges crossed by a ray
Polygon triangulation (ear clipping) usd/earcut.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Adding tile results to the picture
The sums of red, green, blue and sample count of every pixel after a pass.
out[pixel] += tile[pixel]
Rendered picture: sample sums and color tables compute/cpu-render.js32-bit, display only- BimCraft
- ModelCraft
A calculation is added only after its source was read. Each statement can be checked in the code shown on its policy's page; the app repositories are public. When a release changes a calculation, its page says so until it has been read again.