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
-
Unit changes on reading
Standard Surface values converted to the app's units.
thin film thickness ÷ 1000; emission ÷ 0.02; opacity = (r + g + b) ÷ 3
MaterialX files: numbers written and read shading/mtlx.js64-bit- BimCraft
- ModelCraft
-
Tile size from uvtiling
The material's tile size in meters from the uvtiling shared by a file's images.
width = 1 ÷ tiling_u; height = 1 ÷ tiling_v
MaterialX files: numbers written and read shading/mtlx.js64-bit- BimCraft
- ModelCraft
-
Mean of an input that varies over the tile
The single value given to a shader input the renderers and the file cannot vary across the surface.
mean = Σ f(uᵢ, vⱼ) ÷ 64², a 64 × 64 grid of texel centers
MaterialX files: numbers written and read shading/bake.js64-bit- BimCraft
- ModelCraft
-
Page box and rotation matrix
The matrix from PDF user space to the page as displayed: origin at the lower-left corner, y up, the page's rotation applied.
0°: [1 0 0 1 −x₀ −y₀]; 90°: [0 −1 1 0 −y₀ W + x₀]; 180°: [−1 0 0 −1 W + x₀ H + y₀]; 270°: [0 1 −1 0 H + y₀ −x₀]
PDF page vectors and snapping to them pdf-vector.js64-bit- CadCraft
- BimCraft
-
Matrix product
Combines the current matrix with one the page's content applies.
[a b c d e f] = m · k for 2 × 3 affine matrices
PDF page vectors and snapping to them pdf-vector.js64-bit- CadCraft
- BimCraft
-
Path points
Each move, line and curve point of a path, taken through the current matrix into displayed-page points.
x′ = a·x + c·y + e; y′ = b·x + d·y + f; quadratic to cubic: c₁ = p + ⅔(q − p), c₂ = x + ⅔(q − x)
PDF page vectors and snapping to them pdf-vector.js32-bit in part- CadCraft
- BimCraft
-
Text position, height and angle
Where each run of text starts, how tall it is, its angle and its width, in displayed-page points.
height = |M·(t₂, t₃)|; angle = atan2 of M·(t₀, t₁); width = |w| × |(m₀, m₁)|
PDF page vectors and snapping to them pdf-vector.js64-bit- CadCraft
- BimCraft
-
Flattening curves to segments
Turns every line and curve of the page into straight segments for snapping.
B(t) = u³p₀ + 3u²t·c₁ + 3u·t²·c₂ + t³p₃, u = 1 − t, t = 1⁄8 … 8⁄8
PDF page vectors and snapping to them pdf-vector.js32-bit in part- CadCraft
- BimCraft
-
Nearest point on a segment
The point of a segment closest to the pointer.
t = ((p − a)·(b − a)) ÷ |b − a|², held to [0, 1]; q = a + t(b − a)
PDF page vectors and snapping to them pdf-snap.js32-bit in part- CadCraft
- BimCraft
-
Crossing of two segments
The point where two segments of the page cross, or nothing when they are parallel, apart, or only meet end to end.
den = r × s; u = ((c − a) × s) ÷ den; v = ((c − a) × r) ÷ den; point = a + u·r
PDF page vectors and snapping to them pdf-snap.js32-bit in part- CadCraft
- BimCraft
-
Choosing the snap point
Picks the end, crossing, middle or nearest point within the snap distance of the pointer.
midpoint = (a + b) ÷ 2; candidate kept when |candidate − p| ≤ tol
PDF page vectors and snapping to them pdf-snap.js32-bit in part- CadCraft
- BimCraft
-
Drawing units per PDF point
The scale that makes a PDF page its true size in the drawing's units.
1 pt = 1⁄72 in; inches: 1 ÷ 72; feet: (1 ÷ 72) ÷ 12; millimeters: 25.4 ÷ 72; meters: 0.0254 ÷ 72
PDF underlay placement and PDF import pdfmodel.js64-bit- CadCraft
-
Underlay scale and rotation for saving
The insertion point, x and y scale and rotation of an underlay as a DWG stores them.
sx = |(m₀, m₁)|; sy = |(m₂, m₃)| × sign(det); rotation = atan2(m₁, m₀)
PDF underlay placement and PDF import pdfmodel.js64-bit- CadCraft
-
Underlay read from a file
Builds the underlay block and its placing reference from a file's PDF underlay record.
PDF underlay placement and PDF import pdfmodel.js64-bit- CadCraft
-
Scale typed when attaching
The scale an attached page gets: its true size, or the number typed.
PDF underlay placement and PDF import pdfunder.js64-bit- CadCraft
-
Inverse of a placement
Takes clip points picked in the drawing back into the page's own points.
det = a·d − b·c; inverse = [d −b −c a (c·f − d·e) (b·e − a·f)] ÷ det
PDF underlay placement and PDF import pdfunder.js64-bit- CadCraft
-
Is this curve a circular arc
Decides whether one cubic curve of the page is an arc of a circle, and if so gives its center, radius and angles.
circle through B(0), B(½), B(1); arc when | |B(t) − c| − r | ≤ 0.002·r at t = 0.25, 0.75, 0.1, 0.9
PDF underlay placement and PDF import pdfunder.js32-bit in part- CadCraft
-
Circle through three points
Center and radius of the circle through three points.
d = 2(aₓ(b_y − c_y) + bₓ(c_y − a_y) + cₓ(a_y − b_y)); center from |a|², |b|², |c|² ÷ d
PDF underlay placement and PDF import pdfunder.js64-bit- CadCraft
-
Outline points of an imported shape
The vertices of each imported path in drawing coordinates, with curves replaced by straight pieces.
B(t) at t = 0.1 … 1.0, then (x, y) → placement matrix
PDF underlay placement and PDF import pdfunder.js32-bit in part- CadCraft
-
Stroke width kept on imported objects
The line width stored on each imported line, arc and polyline.
lw = round(width × scale × 100) ÷ 100
PDF underlay placement and PDF import pdfunder.js64-bit- CadCraft
-
Arcs and circles from curves
Turns a path made only of circular curves into a circle or an arc object.
same circle when |rᵢ − r₀| < 1e-3·r₀ and |cᵢ − c₀| < 1e-3·r₀; circle when Σ sweep = 2π within 1e-3
PDF underlay placement and PDF import pdfunder.js32-bit in part- CadCraft
-
Imported text
Position, height and angle of each imported text.
h = PDF height × scale ÷ FONT_EM; angle = (PDF angle + placement rotation) mod 2π
PDF underlay placement and PDF import pdfunder.js64-bit- CadCraft
-
Scale from two points and a real distance
Rescales an imported page so that two picked points are a stated distance apart.
f = real ÷ |p₂ − p₁|
PDF underlay placement and PDF import pdfunder.js64-bit- CadCraft
-
Scaling an object about a point
Moves and resizes one imported object by the factor f about the insertion point.
x′ = aₓ + (x − aₓ)·f; r′ = r·f; h′ = h·f
PDF underlay placement and PDF import pdfunder.js64-bit- CadCraft
-
Rigid fit from point pairs
The rotation and shift that best take the picked points of one scan onto their targets, with the error left at each pair.
R from the top eigenvector (a quaternion) of Horn's 4 × 4 matrix; t = c_dst − R·c_src; rms = √(Σ rᵢ² ÷ n)
Scan registration register.js64-bit- CadCraft
- BimCraft
-
Eigenvalues of a symmetric matrix
Eigenvalues and eigenvectors of the 3 × 3 and 4 × 4 symmetric matrices the fit and the normals use.
Jacobi rotations: θ = (a_qq − a_pp) ÷ 2a_pq; t = sign(θ) ÷ (|θ| + √(θ² + 1))
Scan registration register.js64-bit- CadCraft
- BimCraft
-
Combining transforms
The product of two 4 × 4 transforms, used to add each iteration's step to the running transform.
o = a · b, each entry a sum of four products
Scan registration register.js64-bit- CadCraft
- BimCraft
-
Inverse of a rigid transform
The transform that undoes a rotation and shift.
R⁻¹ = Rᵀ; t′ = −Rᵀ·t
Scan registration register.js64-bit- CadCraft
- BimCraft
-
Transform in shifted coordinates
Rewrites a transform for coordinates measured from the working origin, and back.
t_local = t + R·o − o; back: t = t_local − R·o + o
Scan registration register.js64-bit- CadCraft
- BimCraft
-
Is a matrix a rigid transform
Checks that a matrix is a pure rotation and shift before it is accepted.
|rᵢ·rⱼ − δᵢⱼ| ≤ tol; |det − 1| ≤ tol; last row 0 0 0 1 within tol
Scan registration register.js64-bit- CadCraft
- BimCraft
-
Rotation about an axis
The 4 × 4 matrix for a turn by an angle about an axis through a center.
R = c·I + s·[axis]ₓ + (1 − c)·axis·axisᵀ; t = center − R·center
Scan registration register.js64-bit- CadCraft
- BimCraft
-
Angle and shift of a transform in words
The rotation angle in degrees and the length of the shift that a result is reported with.
angle = acos((trace − 1) ÷ 2); shift = |t|
Scan registration register.js64-bit- CadCraft
- BimCraft
-
Working points of a scan
The thinned copy of a scan's points, measured from the session origin, that registration works on.
work = pos + cloud origin − session origin, every stride-th point
Scan registration register.js32-bit in part- CadCraft
- BimCraft
-
Nearest point in the fixed scans
For a moved point, the closest point of the fixed scans within the match distance.
d² = Δx² + Δy² + Δz², smallest over the grid cells searched ring by ring
Scan registration register.js64-bit- CadCraft
- BimCraft
-
Surface normals
The direction square to the surface at each fixed point, from its 10 nearest neighbors.
normal = eigenvector of the smallest eigenvalue of the neighbors' covariance
Scan registration register.js32-bit in part- CadCraft
- BimCraft
-
Matching and the error of a step
Pairs each moving point with its nearest fixed point and reports the root-mean-square distance, and the distance along the normals.
rms = √(Σ d² ÷ matched); plane rms = √(Σ ((p − q)·n)² ÷ matched)
Scan registration register.js32-bit in part- CadCraft
- BimCraft
-
Point-to-plane step
The small turn and shift that reduce the distances along the normals in one iteration.
minimize Σ ((ω × p + t + p − q)·n)²: 6 × 6 normal equations for (ω, t); R = rotation by |ω| about ω
Scan registration register.js32-bit in part- CadCraft
- BimCraft
-
Solving the 6 × 6 system
Solves the linear equations of the point-to-plane step.
Gaussian elimination with partial pivoting, then back substitution
Scan registration register.js64-bit- CadCraft
- BimCraft
-
When the iteration stops
Decides when a phase has settled and narrows the match distance for the next step.
stop when |previous − error| ≤ tol × max(error, 1e-12) or error < 1e-12; cut = min(start, max(2.5 × rms, 1e-6 × diagonal))
Scan registration register.js64-bit- CadCraft
- BimCraft
-
Label position and text height
The point where a remnant's number is written and the height of that text.
d = chamfer distance in cells (steps 1 and 1.4142); x = (i + 0.5) × cell; y = (j + 0.5) × cell; h = max(cell, min(0.6 × d × cell, height ÷ 4))
Where a remnant's number is written addons/apparel/lib/nest/nest-stock.js32-bit in part- CadCraft
- PartCraft
-
Gray value of each engraving cell
The average gray of the picture's pixels under each cell of the engraving grid.
gray = Σ w × pixel ÷ Σ w, w = overlap area of pixel and cell
Burn levels of an engraved picture laser/laser-image.js32-bit in part- CadCraft
- PartCraft
-
Burn level of each cell
Turns the gray values into burn levels from 0 to 255 by the chosen method.
darkness = 1 − (gray ÷ 255)^gamma; threshold: darkness > t; gray steps: round(round(darkness × (n − 1)) ÷ (n − 1) × 255)
Burn levels of an engraved picture laser/laser-image.js32-bit in part- CadCraft
- PartCraft
-
Adding a layer
Creates a layer of 1 to 16 numbers per element.
Polygon mesh: attribute layers (UV, color, crease, weights) m3d/mesh.js32-bit in part- CadCraft
- ModelCraft
-
Storing a value in a layer
Writes the values of one element of a layer.
Polygon mesh: attribute layers (UV, color, crease, weights) m3d/mesh.js32-bit in part- CadCraft
- ModelCraft
-
Blending corner values onto new faces
The values new face corners get when faces are cut or joined, as a weighted mix of old corners.
out = Σ wᵢ × valueᵢ
Polygon mesh: attribute layers (UV, color, crease, weights) m3d/mesh.js32-bit in part- CadCraft
- ModelCraft
-
Layers in the mesh file
The layer data as it is written into the file.
Polygon mesh: attribute layers (UV, color, crease, weights) m3d/mesh.js32-bit in part- CadCraft
- ModelCraft
-
World triangles for export
Every triangle of the model in world coordinates, with its normal.
p_world = M · p; n = normalize((p₁ − p₀) × (p₂ − p₀))
Export to glTF and STL m3d/io.js64-bit- CadCraft
- ModelCraft
-
glTF vertex positions
The vertex coordinates and normals stored in the binary part of a .glb file.
Export to glTF and STL m3d/io.js32-bit in part- CadCraft
- ModelCraft
-
glTF placement matrix
The matrix that places each group or component in the .glb file.
Export to glTF and STL m3d/io.js64-bit- CadCraft
- ModelCraft
-
STL triangles in millimeters
The triangles of a binary STL file.
x_mm = x × 1000, stored as a 32-bit float
Export to glTF and STL m3d/io.js32-bit in part- CadCraft
- 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.