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
-
Snap points of a trace
The ends, middles, arc centers, corners and crossings offered for snapping.
middle = (p₁ + p₂) ÷ 2; arc middle at angle (a₀ + a₁) ÷ 2; corner = mean of the ends within 3 px
Tracing a scan into lines and arcs raster/snap.js64-bit- CadCraft
- BimCraft
- ModelCraft
- CivilCraft
- PartCraft
-
Black-and-white level (Otsu)
The grey level that best separates ink from paper for the whole sheet.
maximize w_B × w_F × (m_B − m_F)² over the 256 levels
Scan clean-up and JPEG decoding raster/image.js64-bit- CadCraft
- BimCraft
- ModelCraft
- CivilCraft
- PartCraft
-
Local threshold (Sauvola)
Decides ink or paper for each pixel from the mean and spread of the pixels around it.
ink when v ≤ mean × (1 + k × (sd ÷ 128 − 1)); sd = √(Σv² ÷ n − mean²)
Scan clean-up and JPEG decoding raster/image.js64-bit- CadCraft
- BimCraft
- ModelCraft
- CivilCraft
- PartCraft
-
Sheet skew angle
The angle by which the long lines of a scanned sheet are rotated.
score(angle) = Σ rows² + Σ columns² of the ink projected at that angle; best angle on a 0.25° then 0.02° grid
Scan clean-up and JPEG decoding raster/image.js64-bit- CadCraft
- BimCraft
- ModelCraft
- CivilCraft
- PartCraft
-
Rotating the image
Turns a grey image by an angle about its middle.
source = c + R(angle) × (pixel − c); value = bilinear mix of the 4 nearest source pixels
Scan clean-up and JPEG decoding raster/image.js64-bit- CadCraft
- BimCraft
- ModelCraft
- CivilCraft
- PartCraft
-
JPEG inverse cosine transform
Turns the stored frequency coefficients of an 8 × 8 block back into pixel values.
pixel = round(Σ_u Σ_v C(x,u)·C(y,v)·coef(u,v) + 128), clamped to 0–255
Scan clean-up and JPEG decoding raster/jpeg.js64-bit- CadCraft
- BimCraft
- ModelCraft
- CivilCraft
- PartCraft
-
JPEG color conversion
Converts the decoded luminance and color-difference values to red, green and blue.
R = Y + 1.402·Cr; G = Y − 0.344136·Cb − 0.714136·Cr; B = Y + 1.772·Cb
Scan clean-up and JPEG decoding raster/jpeg.js64-bit- CadCraft
- BimCraft
- ModelCraft
- CivilCraft
- PartCraft
-
Matrix product
Combines two transforms into one.
o[c][r] = Σₖ a[k][r] × b[c][k]
USD transforms and placement usd/geom.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Matrix inverse
The transform that undoes another.
inverse = cofactor matrix ÷ determinant
USD transforms and placement usd/geom.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Transforming a point
Applies a transform to a point.
p′ = (M × [x, y, z, 1]) ÷ w
USD transforms and placement usd/geom.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Rotation about an axis
The matrix of a rotation by an angle in degrees about X, Y or Z.
a = deg × π ÷ 180; entries cos a, ± sin a
USD transforms and placement usd/geom.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Quaternion to rotation matrix
The rotation matrix of an orientation stored as a quaternion.
q ÷ |q|; R₀₀ = 1 − 2(y² + z²), R₀₁ = 2(xy + wz), …
USD transforms and placement usd/geom.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Value at a time
An animated value at a given time, between its stored samples.
v = a + (b − a) × (t − t₀) ÷ (t₁ − t₀)
USD transforms and placement usd/geom.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
An object's own transform
Builds the transform of one object from its list of translate, rotate, scale and matrix operations.
M = op₁ × op₂ × … in the listed order; an inverted operation uses its inverse
USD transforms and placement usd/geom.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
World transform
The transform of an object in the scene, through all its parents.
W = M_root × … × M_parent × M_own
USD transforms and placement usd/geom.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Scene units and up axis
The transform from the scene's own units and up axis to meters with Z up.
scale by metersPerUnit; Y-up scenes: rotate 90° about X
USD transforms and placement usd/geom.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Placement of instanced copies
The transform of each copy of a point instancer from its position, orientation and scale.
M = translate(p) × rotate(q) × scale(s)
USD transforms and placement usd/scene.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Writing an object's transform
Stores an object's placement in the exported scene.
USD transforms and placement usd/build.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Attribute value to its storage type
Converts a list of numbers to the number type its USD attribute type calls for.
USD mesh coordinates in saved and exported files usd/build.js32-bit in part- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Mesh points and extent
Stores the points of a mesh and its bounding box in the scene.
extent = [min x, min y, min z, max x, max y, max z] of the points
USD mesh coordinates in saved and exported files usd/build.js32-bit in part- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Lamp intensity
Converts a lamp's lumens to the intensity a renderer reads.
intensity = lumens ÷ (683 × area × π)
USD mesh coordinates in saved and exported files usd/build.js32-bit, display only- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Single values in the binary file
Writes one number, tuple or matrix into the binary USD file.
USD mesh coordinates in saved and exported files usd/usdc-write.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Arrays in the binary file
Writes an array of numbers into the binary USD file.
USD mesh coordinates in saved and exported files usd/usdc-write.js32-bit in part- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Reading a mesh
The points, faces and attached values of a mesh read from a USD scene.
USD mesh coordinates in saved and exported files usd/geom.js32-bit in part- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Built-in shapes as meshes
A cube, sphere, cylinder, cone, capsule or plane of a USD scene as a mesh.
ring point = (r·cos θ, r·sin θ, z), θ = 2π·j ÷ 24
USD mesh coordinates in saved and exported files usd/geom.js64-bit- CadCraft
- BimCraft
- ModelCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
- PartCraft
-
Matrix inverse
The inverse of the normal matrix, used for the solution and for the cofactors behind the error ellipses.
[N | I] → [I | N⁻¹] by row operations
Survey network adjustment adjust.js64-bit- CivilCraft
-
Observation equations
For each distance, direction, angle, azimuth, vector or control observation: observed minus computed, and its partial derivatives.
l = observed − computed; ∂d/∂x = Δx ÷ d; ∂az/∂x = Δy ÷ d²; ∂az/∂y = −Δx ÷ d²
Survey network adjustment adjust.js64-bit- CivilCraft
-
Gauss-Newton iteration
Builds the weighted normal equations, solves for the corrections and applies them until they are small.
N = AᵀPA; u = AᵀPl; Δx = N⁻¹u; P = 1 ÷ σ²
Survey network adjustment adjust.js64-bit- CivilCraft
-
Variance factor, redundancy and standardized residuals
The a posteriori standard deviation of unit weight, each observation's redundancy number and its standardized residual.
σ̂₀ = √(vᵀPv ÷ dof); r = 1 − w·aᵀQa; w-test = v ÷ (σ·√r)
Survey network adjustment adjust.js64-bit- CivilCraft
-
Error ellipses
The semi-axes and azimuth of each free point's confidence ellipse, and its standard deviations in x and y.
λ = (qxx + qyy ± √((qxx − qyy)² + 4qxy²)) ÷ 2; axis = k·σ̂₀·√λ; k = √(−2 ln(1 − confidence))
Survey network adjustment adjust.js64-bit- CivilCraft
-
Chi-square limits
The lower and upper limits the variance test compares vᵀPv with.
χ²(p, k) ≈ k·(1 − 2/(9k) + z·√(2/(9k)))³
Survey network adjustment adjust.js64-bit- CivilCraft
-
Critical value for the residual test
The two-sided normal critical value for the chosen significance level.
t = √(−2 ln(α/2)); z ≈ t − (c₀ + c₁t + c₂t²) ÷ (1 + d₁t + d₂t² + d₃t³)
Survey network adjustment adjust.js64-bit- CivilCraft
-
Leveling network
Adjusted heights of the free points from observed height differences, with residuals and standard deviations.
weight = 1 ÷ σ², or 1 ÷ length; h = N⁻¹u
Survey network adjustment adjust.js64-bit- CivilCraft
-
Traverse by the compass rule
Traverse coordinates, the misclosure, and each point corrected in proportion to the distance traveled.
x += d·sin(az), y += d·cos(az); correction = misclosure × (length so far ÷ perimeter); precision = perimeter ÷ misclosure
Survey network adjustment adjust.js64-bit- CivilCraft
-
Adjusted points as CSV
The export of adjusted coordinates and ellipse values, one point per line.
value written = round(v × 10⁴) ÷ 10⁴
Survey network adjustment adjust.js64-bit- CivilCraft
-
Angle to (−π, π]
Brings a direction difference into one turn, so a deflection is read the short way round.
Alignment lines and circular curves alignment.js64-bit- CivilCraft
-
Deflection, tangent lengths and curve center at a PI
The deflection angle at each PI, the tangent length of a plain curve, and for a curve with transitions the center and the two tangent lengths.
Δ = a₂ − a₁; T = R·tan(Δ/2); center from n₁·c = R + p₁, n₂·c = R + p₂; T₁ = k₁ − u₁·c, T₂ = u₂·c + k₂
Alignment lines and circular curves alignment.js64-bit- CivilCraft
-
Circular curve and its facts
The arc's center, start angle, length, external, middle ordinate and chord, and the PC and PT stations.
L = R·Δ; E = R·(1 ÷ cos(Δ/2) − 1); M = R·(1 − cos(Δ/2)); chord = 2R·sin(Δ/2)
Alignment lines and circular curves alignment.js64-bit- CivilCraft
-
Transition, curve, transition at one PI
The circular arc left between two transitions and the stations TS, SC, CS and ST.
Δc = |Δ| − θ₁ − θ₂; Lc = R·Δc
Alignment lines and circular curves alignment.js64-bit- CivilCraft
-
Point and direction at a station
The coordinates and forward direction on the alignment at a station.
line: p₀ + s·(cos dir, sin dir); arc: c + R·(cos a, sin a), a = a₀ ± s ÷ R
Alignment lines and circular curves alignment.js64-bit- CivilCraft
-
Station and offset of a point
The nearest station on the alignment to a point, and how far left or right of it the point lies.
line: s = (p − p₀)·u clamped to the element; arc: s = R × swept angle; offset = (p − foot) × direction
Alignment lines and circular curves alignment.js64-bit- CivilCraft
-
Station ticks
The points at every whole multiple of the station interval.
station = k × step, k whole
Alignment lines and circular curves alignment.js64-bit- CivilCraft
-
Clothoid point
The offsets along and across the tangent, and the turn so far, at a distance along a clothoid.
θ = l² ÷ (2·R·Ls); x = l·Σ (−1)ⁿ θ²ⁿ ÷ ((2n)!·(4n+1)); y = l·Σ (−1)ⁿ θ²ⁿ⁺¹ ÷ ((2n+1)!·(4n+3))
Transition curves and sampled alignment geometry alignment.js64-bit- CivilCraft
-
Gauss-Legendre quadrature
The integral the other transition kinds and the cubic parabola's length are computed with.
∫ f ≈ (h ÷ 2)·Σ panels Σ₈ wₖ·f(mid + (h ÷ 2)·xₖ)
Transition curves and sampled alignment geometry alignment.js64-bit- CivilCraft
-
Curvature shapes
The curvature law of each transition kind and its integral, which gives the turn angle.
κ = f(u) ÷ R; θ = Ls·F(u) ÷ R; u = l ÷ Ls
Transition curves and sampled alignment geometry alignment.js64-bit- CivilCraft
-
Length along a cubic parabola
The true length of a cubic parabola transition from its start to a distance along the tangent.
s(x) = ∫₀ˣ √(1 + (v² ÷ (2·R·Ls))²) dv
Transition curves and sampled alignment geometry alignment.js64-bit- CivilCraft
-
Cubic parabola parameter from a length
The tangent length Ls of the cubic parabola whose curve has a given length.
Transition curves and sampled alignment geometry alignment.js64-bit- CivilCraft
-
Point on a transition of any kind
The offsets and turn at a distance along a transition, for all six kinds.
x = ∫₀ˡ cos θ(s) ds; y = ∫₀ˡ sin θ(s) ds
Transition curves and sampled alignment geometry alignment.js64-bit- CivilCraft
-
Transition constants
The end offsets Xc and Yc, the shift p and the tangent offset k of a transition, and its true length.
p = Yc − R·(1 − cos θ); k = Xc − R·sin θ
Transition curves and sampled alignment geometry alignment.js64-bit- CivilCraft
-
Transition element and its long and short tangents
Places a transition on the alignment and works out its own point of intersection.
long tangent = Xc − Yc ÷ tan θ; short tangent = Yc ÷ sin θ
Transition curves and sampled alignment geometry alignment.js64-bit- CivilCraft
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.