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

  • Integration of one substep

    Advances each moving body's speed, position and turn by one substep under gravity.

    v += g h; x += v h; q += ½ h (ω, 0) q, made unit

    Rigid body simulation anim/physics.js
    • ModelCraft
    64-bit
  • Contacts and static friction

    Pushes each touching point out of the surface and holds it still where friction can.

    μ = √(μ_a μ_b); held when slide < μ |λ| × 1.5 + 1e-9

    Rigid body simulation anim/physics.js
    • ModelCraft
    64-bit
  • Velocities from positions

    Works each body's speed and spin back from how far it moved in the substep.

    v = (x − x_prev) ÷ h; ω = 2 ÷ h × vector part of (q × q_prev⁻¹)

    Rigid body simulation anim/physics.js
    • ModelCraft
    64-bit
  • Dynamic friction and bounce

    Slows sliding at each contact and sets the speed a body leaves a surface with.

    friction impulse = min(μ |λ| ÷ h, sliding speed ÷ inverse mass); leaving speed = −e × min(incoming normal speed, 0); e = 0 when |incoming| < 2 |g · n| h

    Rigid body simulation anim/physics.js
    • ModelCraft
    64-bit
  • Settled test

    Says whether every body has come to rest at the end of the run.

    settled when every |v| < 0.02 and every |ω| < 0.05

    Rigid body simulation anim/physics.js
    • ModelCraft
    64-bit
  • One sample of a property

    Reads one stored sample of a scalar or array property into a typed array.

    Alembic import io/abc.js
    • ModelCraft
    64-bit
  • 16-bit float to a number

    Decodes a half-precision float.

    subnormal: ± m × 2⁻²⁴; normal: ± (1 + m ÷ 1024) × 2^(e − 15)

    Alembic import io/abc.js
    • ModelCraft
    64-bit
  • Which time sample is read

    The index of the stored sample nearest a given time.

    time of sample i = times[i mod n] + floor(i ÷ n) × time per cycle; nearest by |time − t|

    Alembic import io/abc.js
    • ModelCraft
    64-bit
  • An object's transform

    Builds an object's matrix from its list of scale, translate, rotate and matrix operations.

    M = op₁ × op₂ × … (the first operation outermost)

    Alembic import io/abc.js
    • ModelCraft
    64-bit
  • Rotation about an axis

    The matrix of a turn by an angle in degrees about an axis.

    a = deg × π ÷ 180; Rodrigues' formula with the axis made unit

    Alembic import io/abc.js
    • ModelCraft
    64-bit
  • Mesh points into Z up

    Copies the file's points into the model's coordinates.

    (x, y, z) → (x, −z, y)

    Alembic import io/abc.js
    • ModelCraft
    64-bit
  • Node matrix into Z up

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

    M′ = C × M × C⁻¹

    Alembic import io/abc.js
    • ModelCraft
    64-bit
  • Which way the faces turn

    Decides whether the file's faces must be turned round, by comparing each face's own normal with the file's normals.

    Newell normal n = Σ (yₐ − y_b)(zₐ + z_b), …; agree when n · Σ file normals > 0

    Alembic import io/abc.js
    • ModelCraft
    64-bit
  • Reading an accessor

    Reads one accessor's numbers, with its sparse part, into a typed array.

    normalized: v ÷ 127, 255, 32767 or 65535 (signed values not below −1)

    glTF import: reading numbers io/gltf-read.js
    • ModelCraft
    64-bit
  • Positions

    Takes a primitive's positions as 32-bit floats and checks each is a sane number.

    glTF import: reading numbers io/gltf-read.js
    • ModelCraft
    64-bit
  • Matrix from translation, rotation and scale

    A node's 4×4 matrix from its translation, quaternion and scale.

    quaternion made unit; rotation entries 1 − 2(y² + z²), 2(xy + zw), …, each column times its scale

    glTF import: reading numbers io/gltf-read.js
    • ModelCraft
    64-bit
  • A node's local matrix

    Uses the node's 16-number matrix as given, or builds it from translation, rotation and scale.

    glTF import: reading numbers io/gltf-read.js
    • ModelCraft
    64-bit
  • Vertex data of a primitive

    Writes a primitive's positions, normals, texture coordinates, colors and indices.

    glTF export io/gltf-write.js
    • ModelCraft
    64-bit
  • Bounds of the positions

    The smallest and largest x, y and z written with the positions.

    glTF export io/gltf-write.js
    • ModelCraft
    64-bit
  • Shared vertices

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

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

    glTF export io/gltf-write.js
    • ModelCraft
    64-bit
  • Placement matrices

    Writes a placement's matrix on its node.

    entry = 0 when |entry| < 1e-15, else the entry

    glTF export io/gltf-write.js
    • ModelCraft
    64-bit
  • Lamps

    A lamp's intensity and cone as glTF writes them.

    candela = lumens ÷ (4π); outer cone = min(π ÷ 2, angle × π ÷ 360)

    glTF export io/gltf-write.js
    • ModelCraft
    64-bit
  • Saved views as cameras

    A saved view's field of view or height as a glTF camera.

    yfov = fov × π ÷ 180; xmag = ymag = height ÷ 2

    glTF export io/gltf-write.js
    • ModelCraft
    64-bit
  • Node matrix for a lamp or camera

    A matrix at a point whose −Z looks along a direction with +Y as near world up as it can be.

    f = dir made unit; r = (f × up) made unit; u = r × f

    glTF export io/gltf-write.js
    • ModelCraft
    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
  • Vertex quadrics

    Adds each triangle's plane to the error quadric of its three vertices.

    n = unit((b − a) × (c − a)), d = −n·a; Q(v) += [a², ab, ac, ad, b², bc, bd, c², cd, d²]

    Decimate modifier mesh/modifiers.js
    • ModelCraft
    64-bit
  • Border planes

    Adds a plane square to the face through each open border edge, so borders stay in place.

    n = unit((B − A) × face normal), d = −n·A; added four times with n and d multiplied by 10

    Decimate modifier mesh/modifiers.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.