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

  • Reading a text file

    Parses every 'vertex x y z' line.

    STL import and export io/stl.js
    • ModelCraft
    32-bit in part
  • Unit factors

    The factor from the file's unit to meters.

    mm 0.001; cm 0.01; m 1; inch 0.0254; foot 0.3048

    STL import and export io/stl.js
    • ModelCraft
    64-bit
  • Welding corners and applying the unit

    Makes one vertex for every distinct corner and scales it to meters.

    same vertex when x, y and z are equal as text; stored as (x, y, z) × unit factor

    STL import and export io/stl.js
    • ModelCraft
    64-bit
  • Triangles with no area

    Drops triangles whose corners lie on one line.

    dropped when |(b − a) × (c − a)| < 1e-18

    STL import and export io/stl.js
    • ModelCraft
    64-bit
  • Exported triangles

    Writes each triangle's normal and corners in millimeters.

    n = (b − a) × (c − a), made unit; corner (mm) = world corner (m) × 1000

    STL import and export io/stl.js
    • ModelCraft
    64-bit
  • Rounding of every parameter

    Rounds each number of a converted material.

    v → the number nearest v with 7 significant digits

    Imported material parameters io/pbr.js
    • ModelCraft
    64-bit
  • Film thickness and dispersion

    A thin film's thickness in micrometers and a glass's Abbe number.

    thickness (µm) = maximum thickness (nm) ÷ 1000; Abbe number = 20 ÷ dispersion

    Imported material parameters io/pbr.js
    • ModelCraft
    64-bit
  • Emission strength

    Splits an emissive color into a color with a peak of 1 and a luminance.

    peak = largest channel; color = channels ÷ peak; luminance = peak × strength

    Imported material parameters io/pbr.js
    • ModelCraft
    64-bit
  • Shininess to roughness

    A roughness from a Blinn–Phong shininess exponent.

    roughness = (2 ÷ (s + 2))^¼, clamped to [0, 1]

    Imported material parameters io/pbr.js
    • ModelCraft
    64-bit
  • Knot span

    Finds the knot interval that holds a parameter.

    3DM curves and surfaces: points on them io/3dm/geom.js
    • ModelCraft
    • PartCraft
    64-bit
  • de Boor's algorithm

    A point of a B-spline from its control points and knots.

    a = (t − k₀) ÷ (k₁ − k₀); d_j = (1 − a) d_(j−1) + a d_j, repeated degree times

    3DM curves and surfaces: points on them io/3dm/geom.js
    • ModelCraft
    • PartCraft
    64-bit
  • Rational point

    Divides a homogeneous point by its weight.

    (x, y, z) = (X, Y, Z) ÷ w

    3DM curves and surfaces: points on them io/3dm/geom.js
    • ModelCraft
    • PartCraft
    64-bit
  • Point on a NURBS surface

    A surface point from its control net.

    de Boor along v for each active row, then along u, then the division by the weight

    3DM curves and surfaces: points on them io/3dm/geom.js
    • ModelCraft
    • PartCraft
    64-bit
  • Point on a curve

    A point on a line, arc, polyline, NURBS curve or chain of curves at a parameter.

    arc: a = angle mapped from the parameter; p = o + r cos a × x + r sin a × y

    3DM curves and surfaces: points on them io/3dm/geom.js
    • ModelCraft
    • PartCraft
    64-bit
  • A curve as a polyline

    Cuts a curve into chords that stay within a tolerance of it, keeping every knot and corner.

    a piece is halved while its middle or quarter points lie farther than tol from the chord, at most 10 times

    3DM curves and surfaces: points on them io/3dm/geom.js
    • ModelCraft
    • PartCraft
    64-bit
  • Rotation about an axis

    Turns a point about a line by an angle, for surfaces of revolution.

    p′ = o + v cos a + (z × v) sin a + z (z · v)(1 − cos a)

    3DM curves and surfaces: points on them io/3dm/geom.js
    • ModelCraft
    • PartCraft
    64-bit
  • Point on a surface

    A point on a plane, NURBS surface, surface of revolution or sum surface.

    plane: o + a x + b y; revolution: the profile point turned about the axis; sum: p(u) + q(v) + base

    3DM curves and surfaces: points on them io/3dm/geom.js
    • ModelCraft
    • PartCraft
    64-bit
  • Surface normal

    The unit normal of a surface at a point.

    ∂u ≈ S(u + h, v) − S(u − h, v); ∂v likewise; n = ∂u × ∂v, made unit; h = 1e-5 × parameter range

    3DM curves and surfaces: points on them io/3dm/geom.js
    • ModelCraft
    • PartCraft
    64-bit
  • A saved mesh as triangles

    Copies a mesh record's points and splits its quads into triangles.

    3DM surfaces into triangles io/3dm/tess.js
    • ModelCraft
    • PartCraft
    64-bit
  • Joining points that coincide

    Makes one vertex of points that sit at the same place, so the faces of a solid close up.

    q = max(diagonal × 1e-9, 1e-12); same vertex when round(x ÷ q), round(y ÷ q) and round(z ÷ q) are equal

    3DM surfaces into triangles io/3dm/tess.js
    • ModelCraft
    • PartCraft
    64-bit
  • Sampling a shared edge

    Samples an edge once on its 3D curve, for both faces that share it.

    fraction s = (t − t₀) ÷ (t₁ − t₀) along the edge's own direction

    3DM surfaces into triangles io/3dm/tess.js
    • ModelCraft
    • PartCraft
    64-bit
  • Scaling the parameter plane

    Scales u and v so a step in each is about as long on the surface, before triangulating.

    L_u, L_v = lengths of the two mid-lines measured with 8 chords; k_u = L_u ÷ Δu; k_v = L_v ÷ Δv

    3DM surfaces into triangles io/3dm/tess.js
    • ModelCraft
    • PartCraft
    64-bit
  • Halving an interior edge

    Decides whether a triangle edge needs a new point at its middle, and adds it.

    halve when the edge is longer than 2 tol and (|S(mid) − chord middle| > tol or n_a · n_c < cos 20°)

    3DM surfaces into triangles io/3dm/tess.js
    • ModelCraft
    • PartCraft
    64-bit
  • Grid step from the surface's bend

    How far apart interior points are placed, from how much the surface bends.

    k = angle between neighboring normals ÷ their distance (75th percentile of a 9 × 9 grid); h = min(√(8 tol ÷ k), 0.349 ÷ k), not below max(L) ÷ 400 or √(L_u L_v ÷ 40000)

    3DM surfaces into triangles io/3dm/tess.js
    • ModelCraft
    • PartCraft
    64-bit
  • Grid points inside a face

    Picks the grid points that lie inside the face's loops and not too near a side.

    inside by counting crossings of the row (even-odd); kept when at least half a grid step from every side

    3DM surfaces into triangles io/3dm/tess.js
    • ModelCraft
    • PartCraft
    64-bit
  • Extrusions

    Walls along the path from each profile, and caps from the closed profiles with their holes.

    frame: T = path direction, X = up × T, Y = T × X; point = origin + x X + y Y; profile closed when its ends are within max(tol, 1e-9)

    3DM surfaces into triangles io/3dm/tess.js
    • ModelCraft
    • PartCraft
    64-bit
  • Tessellation tolerance

    The distance triangles may stand off a surface, per object.

    base = given tolerance, else the file's, else 0.01; tol = max(base, 0.0015 × diagonal of the object's rough box)

    3DM surfaces into triangles io/3dm/scene.js
    • ModelCraft
    • PartCraft
    64-bit
  • Rough box of an object

    A box round an object from its vertices, curve break points and control points, used only to set the tolerance.

    3DM surfaces into triangles io/3dm/scene.js
    • ModelCraft
    • PartCraft
    64-bit
  • Preset curves

    The control points of a new curve: an S, a Bézier circle, a NURBS circle or a straight path.

    Bézier circle: handle length = r × 0.5522847498; NURBS circle: 8 points on an octagon of radius r ÷ 0.9254

    Curve objects mesh/curve.js
    • ModelCraft
    64-bit
  • Automatic handles

    Places a Bézier point's handles when they are automatic or vector.

    auto: along (next − previous) made unit, a third of each neighbor's distance; vector: a third of the way to each neighbor

    Curve objects mesh/curve.js
    • ModelCraft
    64-bit
  • Point on a cubic Bézier segment

    A point of a segment at a fraction t.

    p = (1 − t)³ a + 3 (1 − t)² t b + 3 (1 − t) t² c + t³ d

    Curve objects mesh/curve.js
    • ModelCraft
    64-bit
  • Point on a NURBS spline

    A point of a NURBS spline at a parameter.

    de Boor on (x w, y w, z w, w), then (x, y, z) ÷ w

    Curve objects mesh/curve.js
    • ModelCraft
    64-bit
  • Sampling a spline

    Points along a spline with tangents, the fraction of the length at each, and the radius and tilt there.

    resolution samples per segment; tangent = (next − previous) made unit; s = Σ chord lengths so far ÷ total

    Curve objects mesh/curve.js
    • ModelCraft
    64-bit
  • Frames along the curve

    A side and an up direction at every sample that twist as little as possible, with the tilt applied.

    double reflection from one sample to the next; closed curve: the leftover angle is undone in proportion to s

    Curve objects mesh/curve.js
    • ModelCraft
    64-bit
  • Taper along the curve

    The scale of the cross-section at a fraction of the length.

    Catmull-Rom through the taper values, not below 0

    Curve objects mesh/curve.js
    • ModelCraft
    64-bit
  • Cross-section

    The outline swept along the curve: a circle, a stadium or a flat ribbon.

    circle: 4 (resolution + 1) points at radius depth; stadium: two half circles offset by ± extrude

    Curve objects mesh/curve.js
    • ModelCraft
    64-bit
  • Sweeping the section

    Places the cross-section at every sample and joins the rings into faces.

    point = sample + side × (−x k) + up × (y k); k = radius × taper

    Curve objects mesh/curve.js
    • ModelCraft
    64-bit
  • Offsetting a loop

    Moves each vertex of a flat outline outward by a distance, with mitered corners.

    m = (n₁ + n₂) made unit; p′ = p + m × d ÷ max(0.25, m · n₁)

    Curve objects mesh/curve.js
    • ModelCraft
    64-bit
  • Filled shapes

    Sorts closed flat loops into outlines and holes and builds the top, bottom and edge of the filled shape.

    nesting: a loop inside an even number of others is an outline; direction from the sign of the shoelace area

    Curve objects mesh/curve.js
    • ModelCraft
    64-bit
  • Adding a point in a segment

    Splits a segment at its middle; a Bézier segment keeps its shape.

    de Casteljau at t = ½

    Curve objects mesh/curve.js
    • ModelCraft
    64-bit
  • Moving, scaling and turning points

    The new place of each selected point and handle while it is dragged.

    grab: p + (M⁻¹ w₁ − M⁻¹ w₀); scale: c + (p − c) × |a₁| ÷ max(1, |a₀|); turn: Rodrigues' formula about the view axis through c

    Curve objects mesh/curve-tool.js
    • ModelCraft
    64-bit
  • A new point at the pointer

    Where a point added after the end of a spline goes.

    world point = pick ray ∩ plane through the last point; local = M⁻¹ × world; flat curve: z = 0

    Curve objects mesh/curve-tool.js
    • ModelCraft
    64-bit
  • Selection center

    The mean position of the selected vertices: the pivot for rotate, scale and spin.

    c = (Σ pᵢ) × (1 ÷ n)

    Mesh edit moves: grab, rotate, scale, extrude, spin, knife, bisect mesh/edit-tool.js
    • ModelCraft
    64-bit
  • Point on an axis nearest the pointer

    The point of a line through w along dir that is nearest the pointer's ray; used for axis-locked moves and extrude distances.

    s = (b·e − c·d) ÷ (a·c − b²); point = w + d₁·s

    Mesh edit moves: grab, rotate, scale, extrude, spin, knife, bisect mesh/edit-tool.js
    • ModelCraft
    64-bit
  • Grab, rotate and scale

    Builds the move applied to every affected vertex in world space.

    grab: p′ = p + d; rotate: p′ = R(k, θ)(p − P) + P; scale: p′ = P + f·(p − P), or along a locked axis a: p′ = p + a·((p − P)·a)·(f − 1)

    Mesh edit moves: grab, rotate, scale, extrude, spin, knife, bisect mesh/edit-tool.js
    • ModelCraft
    64-bit
  • Rotation about an axis

    Turns a point about the axis k through c by the angle a.

    q = p − c; p′ = c + q·cos a + (n × q)·sin a + n·(n·q)·(1 − cos a)

    Mesh edit moves: grab, rotate, scale, extrude, spin, knife, bisect mesh/edit-tool.js
    • ModelCraft
    64-bit
  • Extrude distance

    Moves the new vertices of an extrusion by the dragged or typed distance along the region's normal, or along each face's own normal.

    d = (line point now − line point at start)·dir; p′ = p + dirL·d, dirL = M⁻¹·dir

    Mesh edit moves: grab, rotate, scale, extrude, spin, knife, bisect mesh/edit-tool.js
    • ModelCraft
    64-bit
  • Knife point on an edge

    Where along an edge a knife click lands, as a fraction of the edge from its start.

    s = clamp((q − a)·(b − a) ÷ L², 0, 1)

    Mesh edit moves: grab, rotate, scale, extrude, spin, knife, bisect mesh/edit-tool.js
    • ModelCraft
    64-bit
  • Bisect plane

    The cutting plane through two clicked points as seen from the camera, in the mesh's own space.

    n = unit((p₂ − p₁) × ray direction); plane = {M⁻¹·p₁, unit(M⁻¹ applied to n as a direction)}

    Mesh edit moves: grab, rotate, scale, extrude, spin, knife, bisect mesh/edit-tool.js
    • ModelCraft
    64-bit
  • Spin center, axis and angle

    The center, axis and total angle handed to the spin operator, in the mesh's own space.

    center = M⁻¹·c; axis = unit(M⁻¹ applied to the world axis); angle = typed × π ÷ 180, or −(a₁ − a₀)

    Mesh edit moves: grab, rotate, scale, extrude, spin, knife, bisect mesh/edit-tool.js
    • ModelCraft
    64-bit

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.