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

  • Piece list on the assembly sheet

    One line per piece with its size and volume, then the joints and the pins.

    size shown = round(mm × 10) ÷ 10; volume shown = round(mm³ ÷ 1000 × 10) ÷ 10 cm³; pin length = dowel length − clearance

    Splitting a model into printable pieces print-split.js
    • ModelCraft
    • PartCraft
    32-bit in part
  • Normal of a slanting cut

    The normal of a cut across one axis, turned by an angle about another axis.

    n = axis·cos r + (about × axis)·sin r, r = degrees × π ÷ 180

    Splitting a model into printable pieces print-split-ui.js
    • ModelCraft
    • PartCraft
    64-bit
  • Cut places typed by the person

    Turns the typed distances from the low end of the model into cut planes.

    point = middle of the box, with axis coordinate lo + v; d = n·point

    Splitting a model into printable pieces print-split-ui.js
    • ModelCraft
    • PartCraft
    64-bit
  • Connector spot picked by hand

    Where the ray under a click crosses the cut plane between two pieces.

    t = (d − n·o) ÷ (n·dir); p = o + dir × t

    Splitting a model into printable pieces print-split-ui.js
    • ModelCraft
    • PartCraft
    64-bit
  • Binary STL

    Writes each triangle's unit normal and three corners.

    normal = n ÷ |n| from the winding; every number written with setFloat32

    STL and 3MF files for the printer print3d.js
    • ModelCraft
    • PartCraft
    32-bit in part
  • A coordinate as 3MF text

    Formats one coordinate for the 3MF file.

    0 if |v| < 10⁻¹²; else v rounded to 10 significant digits

    STL and 3MF files for the printer print3d.js
    • ModelCraft
    • PartCraft
    64-bit
  • 3MF vertex list

    Writes every corner of the mesh as a vertex element.

    STL and 3MF files for the printer print3d.js
    • ModelCraft
    • PartCraft
    64-bit
  • Letter outlines from strokes

    The outline of the text: each stroke segment as a rectangle of the pen's width, each stroke point as a disc.

    r = height × weight ÷ 2; rectangle corners = a ∓ r·n̂, b ∓ r·n̂; disc corner = c + r·[cos(i·π ÷ 6), sin(i·π ÷ 6)]; line k at y − 1.6·k·height

    3D text text3d.js
    • ModelCraft
    64-bit
  • Letters as faces or solids

    The component the app places: flat faces, or a closed solid from z = 0 to the depth.

    g6(v) = round(v × 10⁶) ÷ 10⁶ on every coordinate

    3D text text3d.js
    • ModelCraft
    32-bit in part
  • The four strongest bones per vertex

    Keeps each vertex's four largest weights and scales them to add up to 1.

    w_q = w_q ÷ Σ of the kept weights

    Skin weights and skinning anim/rig.js
    • ModelCraft
    32-bit in part
  • Linear blend skinning

    Moves each vertex to the weighted sum of its positions under its bones' matrices.

    p′ = Σ wᵢ × (Mᵢ × p)

    Skin weights and skinning anim/rig.js
    • ModelCraft
    32-bit in part
  • Dual quaternion skinning

    Blends the bones' dual quaternions by weight, makes the result unit and moves the vertex with it.

    (r, d) = Σ ±wᵢ (rᵢ, dᵢ); both divided by |r|; p′ = r p r⁻¹ + 2 d r⁻¹

    Skin weights and skinning anim/rig.js
    • ModelCraft
    32-bit in part
  • Distance from a point to a bone

    The distance from a vertex to the segment from a bone's head to its tail.

    k = clamp(((p − a) · (b − a)) ÷ |b − a|², 0, 1); d = |a + (b − a) k − p|

    Skin weights and skinning anim/weights.js
    • ModelCraft
    64-bit
  • Edge weights of the mesh

    For each vertex, its neighbors and a weight for each edge, used to spread heat and to smooth.

    edge weight = 1 ÷ max(1e-12, length²)

    Skin weights and skinning anim/weights.js
    • ModelCraft
    64-bit
  • Automatic weights

    Each bone's weight on each vertex, by bone heat or by distance, with faint weights dropped and each vertex's weights adding up to 1.

    heat: solve (L + H) w = H p per bone, H = 1 ÷ nearest distance²; envelope: w = 1 ÷ d⁴ for bones within twice the nearest distance; drop w < 0.01; divide by the sum

    Skin weights and skinning anim/weights.js
    • ModelCraft
    32-bit in part
  • One dab of the weight brush

    Raises, lowers, sets or smooths a bone's weight on the vertices under the brush, and scales the other bones' weights to share what is left.

    falloff f = (1 − d² ÷ r²)² × strength; add: w + f (1 − w); subtract: w − f w; others scaled by max(0, 1 − w) ÷ their sum

    Skin weights and skinning anim/weights.js
    • ModelCraft
    32-bit in part
  • Weights from packed joint layers

    Turns the four joint numbers and weights per vertex read from a file into one weight layer per bone.

    weight of bone b on vertex v = Σ of the packed weights that name b

    Skin weights and skinning anim/weights.js
    • ModelCraft
    32-bit in part
  • Skin weights read from an FBX file

    Keeps each control point's four strongest clusters and scales their weights to add up to 1.

    w = w ÷ Σ of the four kept weights

    Skin weights and skinning io/fbx-import.js
    • ModelCraft
    32-bit in part
  • Morph weights and the skin

    A primitive's positions and normals as the scene shows them: morph targets added by their weights, then moved by the skin's joints.

    morph: p += w × target; skin: p′ = Σ wᵢ (Jᵢ × IBMᵢ × p) ÷ Σ wᵢ

    glTF import: meshes, skins and placements io/gltf-import.js
    • ModelCraft
    32-bit in part
  • Welding vertices

    Makes one mesh vertex for every distinct point of a primitive and swaps the axes to Z up.

    same vertex when x, y and z (and joints and weights) are equal as text; stored as (x, −z, y)

    glTF import: meshes, skins and placements io/gltf-import.js
    • ModelCraft
    64-bit
  • Triangles with no area

    Drops triangles that repeat a vertex or whose corners lie on one line.

    kept when |(b − a) × (c − a)| > 1e-18

    glTF import: meshes, skins and placements io/gltf-import.js
    • ModelCraft
    64-bit
  • Sharp edges

    Marks an edge sharp where the file's normals break across it, or where the two faces bend.

    with normals: sharp unless n₁ · n₂ > 0.9995 at both ends; without: sharp when the face normals' dot product < 0.99996

    glTF import: meshes, skins and placements io/gltf-import.js
    • ModelCraft
    64-bit
  • Node matrix into Z up

    Changes a node's matrix from Y up to Z up.

    M′ = C × M × C⁻¹

    glTF import: meshes, skins and placements io/gltf-import.js
    • ModelCraft
    64-bit
  • Instanced placements

    One placement per instance from the file's per-instance translation, rotation and scale.

    glTF import: meshes, skins and placements io/gltf-import.js
    • ModelCraft
    64-bit
  • Texture coordinate transform

    Applies a texture's offset, rotation and scale to a UV pair.

    u′ = cos r × u s_u + sin r × v s_v + o_u; v′ = −sin r × u s_u + cos r × v s_v + o_v

    glTF import: meshes, skins and placements io/gltf-import.js
    • ModelCraft
    64-bit
  • Lamps

    A lamp's position, direction, brightness and cone from a glTF light.

    lumens = candela × 4π; spot angle (°) = 2 × outer cone × 180 ÷ π

    glTF import: meshes, skins and placements io/gltf-import.js
    • ModelCraft
    64-bit
  • Cameras

    A saved view's eye, target and field of view from a glTF camera.

    target = eye + 10 × forward; field of view (°) = yfov × 180 ÷ π; parallel view height = 2 × |ymag|

    glTF import: meshes, skins and placements io/gltf-import.js
    • ModelCraft
    64-bit
  • Reading one number

    Reads a value of the type the header names, from text or from binary.

    PLY import and export io/ply.js
    • ModelCraft
    64-bit
  • Imported positions

    Stores each vertex's x, y and z.

    PLY import and export io/ply.js
    • ModelCraft
    64-bit
  • Points and normals in world coordinates

    Carries a point and a normal through a placement's matrix for export.

    p′ = M × p; n′ = (M × n without translation), made unit

    PLY import and export io/ply.js
    • ModelCraft
    64-bit
  • Exported positions

    Writes each vertex's world position and normal into the file.

    PLY import and export io/ply.js
    • ModelCraft
    32-bit in part
  • Shared vertices on export

    Gives corners with the same position, normal, color and UV one vertex.

    key = x, y, z as numbers + normal to 5 decimals + color + UV

    PLY import and export io/ply.js
    • ModelCraft
    64-bit
  • Reading a binary file

    Reads each triangle's nine coordinates and its color word.

    STL import and export io/stl.js
    • ModelCraft
    64-bit
  • 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
  • Proportional editing weights

    For every vertex, how much of the selected vertices' move it follows: 1 for the selected ones, falling to 0 at the radius.

    t = distance ÷ radius; smooth: x²(3 − 2x) with x = 1 − t; sphere: √(1 − t²); root: √x; linear: x; sharp: x²; constant: 1

    Proportional editing weights and edge creases mesh/ops.js
    • ModelCraft
    32-bit in part
  • Set a crease

    Stores the crease (0 smooth to 1 sharp) on each listed edge for subdivision.

    v = clamp(value, 0, 1)

    Proportional editing weights and edge creases mesh/ops.js
    • ModelCraft
    32-bit in part
  • Crease shared by edges

    The crease the selected edges have in common, shown as the starting value when a crease is edited.

    Proportional editing weights and edge creases mesh/ops.js
    • ModelCraft
    32-bit in part
  • Applying a move with proportional weights

    Writes each affected vertex's new position while a grab, rotate or scale is in progress.

    q = T(p); r = p + (q − p)·w; stored position = M⁻¹·r

    Proportional editing weights and edge creases mesh/edit-tool.js
    • ModelCraft
    32-bit in part
  • Crease from the pointer or the wheel

    Turns the pointer's distance from the selection's center, or a wheel step, into a crease between 0 and 1.

    pointer: crease = clamp(round(px ÷ 2) ÷ 100, 0, 1); wheel: crease = clamp(round((crease ± 0.1) × 10) ÷ 10, 0, 1)

    Proportional editing weights and edge creases mesh/edit-tool.js
    • ModelCraft
    32-bit in part
  • Boolean of two meshes

    Runs the union, intersection or difference and copies the result's vertex positions.

    Boolean modifier mesh/modifiers.js
    • ModelCraft
    32-bit in part
  • Mesh from triangles

    Builds a mesh from triangle positions and indices, welds coincident vertices and marks sharp edges; used after a boolean and after decimate.

    weld within 1e-9; sharp when n₁·n₂ < cos(30°)

    Boolean modifier mesh/modifiers.js
    • ModelCraft
    64-bit
  • Squared distance to a triangle

    The squared distance from a point to the nearest point of a triangle.

    q = nearest point by region (vertex, edge or interior); d² = |p − q|²

    Voxel remesh and snapping onto a surface mesh/remesh.js
    • ModelCraft
    64-bit
  • Distance samples near the surface

    For every grid point within two voxels of a triangle, the distance to the nearest triangle.

    g = voxel ÷ 2; d(i, j, k) = √(min over triangles of d²), capped at 2·voxel

    Voxel remesh and snapping onto a surface mesh/remesh.js
    • ModelCraft
    32-bit in part
  • Inside or outside

    Marks each grid point as inside or outside the mesh by counting the faces a ray along +x crosses.

    crossing when w₀, w₁, w₂ share a sign; x = (w₀·x_A + w₁·x_B + w₂·x_C) ÷ (w₀ + w₁ + w₂); inside when the winding count before x is above 0

    Voxel remesh and snapping onto a surface mesh/remesh.js
    • ModelCraft
    64-bit
  • Level set of the samples

    The distance at any point by blending the eight samples round it, handed to the library that builds the new mesh.

    f(x, y, z) = −trilinear blend of the 8 samples; new mesh = level set of f at 0 with edge length = voxel

    Voxel remesh and snapping onto a surface mesh/remesh.js
    • ModelCraft
    32-bit in part
  • Put vertices on a surface

    Moves each listed vertex to the nearest point of a target surface.

    Voxel remesh and snapping onto a surface mesh/remesh.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.