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.

  • 6,917 calculations in 1,248 source files
  • 143 exact
  • 6,286 in 64-bit
  • 335 with a 32-bit step
  • Last reviewed

Calculations

  • Radii and cone angles

    The radius of a cylinder, cone, sphere or torus in millimeters and a cone's half angle in radians.

    r × unit in mm; α × angle unit, accepted when 0 < |α| < π ÷ 2

    STEP import: units, points and assembly placement step/read.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Knot vectors

    The full knot vector of a B-spline from the file's knots and multiplicities, or the one a uniform, quasi-uniform or Bézier form implies.

    STEP import: units, points and assembly placement step/read.js
    • BimCraft
    • ModelCraft
    • PartCraft
    Exact
  • Model size and chord tolerance

    The size of the model and the distance a triangle may stray from a curved face.

    size = diagonal of the box around every point; tol = max(4e-4 × size, 1e-4 mm)

    STEP import: units, points and assembly placement step/read.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Closing a loop of edges

    Drops the last point of an edge loop when it repeats the first.

    |first − last| ≤ 0.01 × tol

    STEP import: units, points and assembly placement step/read.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Placement matrices

    A placement as a 4 × 4 matrix, the product of two and the inverse of one.

    M⁻¹ = [Rᵀ, −Rᵀ t]

    STEP import: units, points and assembly placement step/read.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • A component placed in its assembly

    The transform that carries a component's coordinates into the assembly that uses it.

    T = M(A₂) × M(A₁)⁻¹

    STEP import: units, points and assembly placement step/read.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Placed vertex positions

    Every vertex of a solid moved to its place and stored for the app.

    p′ = R p + t

    STEP import: units, points and assembly placement step/read.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Faceted faces

    Triangles for a flat face given as loops of points.

    n = Σ ((yᵢ − yⱼ)(zᵢ + zⱼ), (zᵢ − zⱼ)(xᵢ + xⱼ), (xᵢ − xⱼ)(yᵢ + yⱼ))

    STEP import: units, points and assembly placement step/read.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Points along an edge

    The points of an edge from its start vertex to its end vertex along its curve.

    STEP import: triangles for curved faces step/tess.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • How finely a curve is divided

    The parameters at which an edge curve is sampled.

    circle step = min(π ÷ 24, 2 acos(1 − tol ÷ r)); else halve while the middle is more than tol from the chord or the turn exceeds π ÷ 24

    STEP import: triangles for curved faces step/tess.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Turn and crossing tests

    Whether three points turn left, right or run straight, and whether two segments cross.

    x = (a − o) × (b − o); left when x > 1e-9 × |ab| × |bc|, right when x < −1e-9 × |ab| × |bc|

    STEP import: triangles for curved faces step/tess.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Holes joined to the outer ring

    One ring made from a face's outer loop and its holes by bridges, ready for ear clipping.

    STEP import: triangles for curved faces step/tess.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Ear clipping

    Triangles of a simple polygon in the plane.

    STEP import: triangles for curved faces step/tess.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • A loop in the surface's (u, v)

    The parameters of each boundary point, with periodic directions unwrapped and poles split.

    uᵢ ← uᵢ + round((uⱼ − uᵢ) ÷ period) × period

    STEP import: triangles for curved faces step/tess.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Scaled layout and first triangles

    The (u, v) points scaled to lengths, the loops given their turning sense, and the first triangulation.

    M = (u × s_u, v × s_v); loop sense = sign of Σ (xᵢ yⱼ − xⱼ yᵢ)

    STEP import: triangles for curved faces step/tess.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Apex of a cone

    The parameter at which a cone's radius reaches zero, for a face that closes at the apex.

    R = |S(0, 0) − S(π, 0)| ÷ 2; k = |S(0, 1) − S(π, 1)| ÷ 2 − R; v_apex = −R ÷ k

    STEP import: triangles for curved faces step/tess.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Interior grid spacing

    How far apart interior points are placed on each kind of surface.

    angle step = min(π ÷ 24, 2 acos(1 − tol ÷ r))

    STEP import: triangles for curved faces step/tess.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Interior points inserted

    Grid points added inside a face and joined into the triangulation.

    STEP import: triangles for curved faces step/tess.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • In-circle test

    Whether a fourth point lies inside the circle through three others.

    det of rows (a − d, |a − d|²), (b − d, |b − d|²), (c − d, |c − d|²)

    STEP import: triangles for curved faces step/tess.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Edge flips

    Inside edges flipped toward a Delaunay triangulation in the scaled (u, v).

    STEP import: triangles for curved faces step/tess.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Refinement to the chord tolerance

    Inside edges split where the surface is farther than the tolerance from the triangles.

    split when |S(mid uv) − (P_a + P_b) ÷ 2| > tol, or when a triangle's center is more than tol from its plane

    STEP import: triangles for curved faces step/tess.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Facing and self-check

    The 3D position of every point, the triangles turned to face outward, and a check of how far the mesh is from the surface.

    worst = max |S(center uv) − center of triangle| over up to 64 triangles; noted when worst > 25 × tol

    STEP import: triangles for curved faces step/tess.js
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Distance between two points

    The length a headset measurement reports.

    d = √(Δx² + Δy² + Δz²)

    Headset review: measuring, section cuts and issue cameras xr/xr-core.js
    • BimCraft
    • ModelCraft
    64-bit
  • Snap to a corner

    The corner of the hit triangle nearest the hit, when it is within the snap radius.

    Headset review: measuring, section cuts and issue cameras xr/xr-core.js
    • BimCraft
    • ModelCraft
    64-bit
  • Model to headset transform

    The matrix that places the model in the headset's space.

    M = T(anchor) · R_y(yaw) · S(scale) · T(−at)

    Headset review: measuring, section cuts and issue cameras xr/xr-core.js
    • BimCraft
    • ModelCraft
    64-bit
  • Inverse of a rig or pose

    The inverse of a rigid motion with one uniform scale.

    M⁻¹ = [Rᵀ ÷ s², −(Rᵀ ÷ s²) t], s² = squared length of the first column

    Headset review: measuring, section cuts and issue cameras xr/xr-core.js
    • BimCraft
    • ModelCraft
    64-bit
  • Section plane

    The plane of a section cut through what was pointed at.

    n = normal toward the eye; p = hit − n × depth; d = n·p

    Headset review: measuring, section cuts and issue cameras xr/xr-core.js
    • BimCraft
    • ModelCraft
    64-bit
  • Issue camera

    The viewpoint, direction and up vector saved with an issue, in the app's coordinates.

    to app = M_up⁻¹ · M_rig⁻¹; eye = to app × head position

    Headset review: measuring, section cuts and issue cameras xr/xr-core.js
    • BimCraft
    • ModelCraft
    64-bit
  • The point being pointed at

    The model point, surface normal and triangle under a controller's ray.

    Headset review: measuring, section cuts and issue cameras xr/xr-session.js
    • BimCraft
    • ModelCraft
    32-bit in part
  • A measurement in the headset

    The length shown on the label between two picked points.

    d = |q − p|, shown through the app's length format

    Headset review: measuring, section cuts and issue cameras xr/xr-session.js
    • BimCraft
    • ModelCraft
    32-bit in part
  • Where an issue is placed

    The point and camera handed to the app with a new issue.

    Headset review: measuring, section cuts and issue cameras xr/xr-session.js
    • BimCraft
    • ModelCraft
    32-bit in part
  • Two-point fit

    The turn and move that carry two model points onto two site points, with the remaining error.

    yaw = atan2(Δw) − atan2(Δm); t = mid(w) − R mid(m); residual = max(|R m₁ + t − w₁|, |R m₂ + t − w₂|); scale off = |Δw| ÷ |Δm| − 1

    AR on site: lining the model up with the building xr/xr-core.js
    • BimCraft
    • ModelCraft
    64-bit
  • A saved alignment applied

    A model point moved to the site by the alignment kept in the file.

    (x′, z′) = (x cos yaw − z sin yaw + t_x, x sin yaw + z cos yaw + t_z)

    AR on site: lining the model up with the building xr/xr-core.js
    • BimCraft
    • ModelCraft
    64-bit
  • Re-check on a later visit

    How far the first reference point is from where the saved alignment puts it, and what to do about it.

    offset = √(Δx² + Δz²); keep < 0.05 m ≤ move < 0.5 m ≤ align again

    AR on site: lining the model up with the building xr/xr-core.js
    • BimCraft
    • ModelCraft
    64-bit
  • Placing a reference point

    Takes the site point under the phone's center mark and runs the fit or the re-check with it.

    t_y = (w₁_y + w₂_y) ÷ 2 − (m₁_y + m₂_y) ÷ 2

    AR on site: lining the model up with the building xr/xr-session.js
    • BimCraft
    • ModelCraft
    64-bit
  • Camera jitter per pass

    Moves the camera by less than a pixel each pass so that the sum of passes is anti-aliased.

    j_x = (h₂(i) − ½) × 2 ÷ w; rows 0 and 1 of the projection += j × row 3

    Rendered pictures render/render-core.js
    • BimCraft
    • ModelCraft
    32-bit, display only
  • Section cut for the path tracer

    Clips every triangle of the scene against the section planes before the picture is traced.

    new corner = a + (b − a) × d_a ÷ (d_a − d_b)

    Rendered pictures render/render-pt.js
    • BimCraft
    • ModelCraft
    32-bit, display only
  • Tiling fractal noise

    The noise value behind the library's brick, wood, stone and concrete textures.

    Σ ampₒ × noise(u fₒ, v fₒ) ÷ Σ ampₒ, f doubling and amp × gain per octave

    Rendered pictures render/textures.js
    • BimCraft
    • ModelCraft
    32-bit, display only
  • Normal map bytes

    Turns a baked material's normal layer into the texture three.js reads.

    x = (byte − 128) ÷ 127; z = √(1 − x² − y²); out = (x ÷ 2 + ½) × 255

    Rendered pictures render/three-mats.js
    • BimCraft
    • ModelCraft
    32-bit, display only
  • Average and largest sample count

    The two numbers the render dialog states after an adaptive render.

    avg = round(10 × Σ nᵢ ÷ (w × h)) ÷ 10; max = largest nᵢ

    Samples per pixel reported after a render render/render-pt.js
    • BimCraft
    • ModelCraft
    32-bit in part
  • Probe light as spherical harmonics

    Sums a small traced panorama into the four coefficients per color the view shades with.

    c = Σ L × Y × dΩ, dΩ = (2π ÷ w)(π ÷ h) sin θ

    Real-time view rt/rt-probes.js
    • BimCraft
    • ModelCraft
    32-bit, display only
  • Cube faces to a 360° picture

    Builds the equirectangular panorama from six rendered faces.

    direction from (longitude, latitude); face = largest d·a; color = bilinear mix of four pixels

    Real-time view rt/rt-pano.js
    • BimCraft
    • ModelCraft
    32-bit, display only
  • Display chain for one pixel

    Turns a linear color into the color shown: white balance, exposure, highlight knee, contrast, view transform.

    c ← max(0, WB c) × 2^stops; c ← 0.18 × (c ÷ 0.18)^(1 + contrast)

    Real-time view rt/rt-look.js
    • BimCraft
    • ModelCraft
    32-bit, display only
  • Standing and falling in walk mode

    Keeps the walker's eye at eye height above the floor below, stepping up or falling as the floor changes.

    v ← v − 9.81 Δt; height ← max(floor + eye height, height + v Δt)

    Real-time view rt/rt-walk.js
    • BimCraft
    • ModelCraft
    32-bit, display only
  • Target area and the count asked for

    The area of the faces a scatter set covers and the number of items its density asks for.

    area = Σ ½ |e₁ × e₂|; asked = min(2,000,000, round(area × density)); paint: Σ max(1, round(π r² × density))

    Scattered plants, rocks and people: how many and where rt/rt-scatter.js
    • BimCraft
    • ModelCraft
    64-bit
  • A random point on the target

    Picks a triangle in proportion to its area and a point inside it.

    P = A + a (B − A) + b (C − A), (a, b) reflected when a + b > 1

    Scattered plants, rocks and people: how many and where rt/rt-scatter.js
    • BimCraft
    • ModelCraft
    64-bit
  • Dropping a point onto the target

    Where a vertical ray from a brush dab meets a target triangle.

    t = (e₂·q) ÷ det, det = e₁·(d × e₂)

    Scattered plants, rocks and people: how many and where rt/rt-scatter.js
    • BimCraft
    • ModelCraft
    64-bit
  • Slope and height limits

    Drops a candidate that stands on too steep a face or outside the height range.

    keep when n·up ≥ cos(slope) − 1e-9 and min ≤ p·up ≤ max

    Scattered plants, rocks and people: how many and where rt/rt-scatter.js
    • BimCraft
    • ModelCraft
    64-bit
  • Values to texture bytes

    Stores a value from 0 to 1, or a normal component from −1 to 1, as one byte of a texture layer.

    byte = ⌊255 x + ½⌋; normal byte = ⌊127 x + 128.5⌋

    Material graphs baked to textures shading/bake.js
    • BimCraft
    • ModelCraft
    32-bit, display only
  • Tiling value noise

    The smooth noise that procedural textures are built from.

    a + (b − a) f_x + (c − a) f_y + (a − b − c + d) f_x f_y, f = t² (3 − 2t)

    Material graphs baked to textures shading/lib.js
    • BimCraft
    • ModelCraft
    32-bit, display only

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.