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

  • Collada positions and normals

    The vertex positions and face normals of each definition in the Collada file.

    Export to OBJ and Collada m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Collada placement matrix

    The 4×4 matrix of each placement, written row by row.

    Export to OBJ and Collada m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Is a face convex

    Decides whether a face is written as one polygon or as triangles in Collada.

    every turn (b − a) × (c − b) ≥ −1e-12 × size²

    Export to OBJ and Collada m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • IFC number format

    How every coordinate, direction component and elevation is written.

    text = x rounded to 9 decimals

    Export to IFC m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Shared points

    The corner points of the faces, each written once.

    Export to IFC m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Is a placement rigid

    Decides whether a group is exported in its own coordinates with a placement, or in world coordinates.

    |column| = 1 ± 1e-9; columns square within 1e-9; determinant > 0

    Export to IFC m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Placement of an element

    Where each exported element sits relative to its level.

    location = (t_x, t_y, t_z − level elevation); axis = third column; ref direction = first column

    Export to IFC m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Level of an element

    Which level an element is listed under.

    the highest level with elevation ≤ z_min + 1e-6

    Export to IFC m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Precision stated in the file

    The precision value the IFC file declares for its geometry.

    Export to IFC m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Drawing unit factors

    The factor from the drawing's unit ($INSUNITS) to meters.

    in 0.0254; ft 0.3048; mi 1609.344; mm 0.001; cm 0.01; m 1; km 1000; yd 0.9144

    Import of DXF and DWG drawings into the 3D model m3d/io.js
    • CadCraft
    • ModelCraft
    Exact
  • Which unit factor is used

    Picks the factor for a drawing.

    Import of DXF and DWG drawings into the 3D model m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Mirrored entities

    How an entity drawn in a flipped coordinate system is read.

    x → −x when the extrusion direction's z is negative

    Import of DXF and DWG drawings into the 3D model m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Arc angles

    The start and end angles of a DXF arc.

    radians = degrees × π ÷ 180; mirrored: (a₀, a₁) → (π − a₁, π − a₀)

    Import of DXF and DWG drawings into the 3D model m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Placing and scaling a segment

    Moves each line segment by the block placements above it and converts it to meters.

    x′ = a·x + c·y + e; y′ = b·x + d·y + f; then × k

    Import of DXF and DWG drawings into the 3D model m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Arcs, circles and bulges as segments

    The points that stand for an arc, a circle or a polyline bulge.

    n = max(2, ⌈|sweep| ÷ (2π ÷ 48)⌉); pⱼ = c + r (cos aⱼ, sin aⱼ), aⱼ = a₀ + sweep × j ÷ n; bulge: sweep = 4 atan b

    Import of DXF and DWG drawings into the 3D model m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Ellipse as segments

    The points that stand for an ellipse or an elliptical arc.

    p = c + major × cos t + minor × sin t, minor = major turned 90° × ratio

    Import of DXF and DWG drawings into the 3D model m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Spline (NURBS) as segments

    The points that stand for a spline with control points.

    de Boor on homogeneous points (x·w, y·w, w); 12 samples per knot span

    Import of DXF and DWG drawings into the 3D model m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Spline stored with fit points only

    The points that stand for a spline that carries fit points and no control points.

    centripetal Catmull–Rom, 12 samples per span

    Import of DXF and DWG drawings into the 3D model m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Bulge arcs in hatch boundaries

    The points of a curved side of a hatch boundary given as a polyline bulge.

    center = chord midpoint + ((1 ÷ b − b) ÷ 2) × (chord turned 90°) ÷ 2; sweep = 4 atan b

    Import of DXF and DWG drawings into the 3D model m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Block insert transform

    The transform that places a block, with its scale, rotation and array spacing.

    M = T(x, y) · R(rot) · S(s_x, s_y) · T(−base); array offset = R(rot) · (col × d_c, row × d_r)

    Import of DXF and DWG drawings into the 3D model m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Hatch holes

    Which loops of a hatch are outlines and which are holes.

    area = ½ |Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)|; a loop inside an odd number of larger loops is a hole

    Import of DXF and DWG drawings into the 3D model m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • 3D face corners

    The corners of 3D faces and solids, which keep their heights.

    (x, y) placed by the block transform; all three × k

    Import of DXF and DWG drawings into the 3D model m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Text line pitch

    The distance between lines of imported multi-line text, which is drawn as edges.

    pitch = height × 1.667 × spacing factor

    Import of DXF and DWG drawings into the 3D model m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Edges of imported solids

    How the edges of an imported solid are matched to decide which ones show.

    key = round(x × 1e5), round(y × 1e5), round(z × 1e5)

    Import of DXF and DWG drawings into the 3D model m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • OBJ vertex

    A vertex line of an OBJ file.

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

    Import of OBJ, glTF and Collada models m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • glTF accessor values

    The numbers of a glTF buffer, such as vertex positions.

    Import of OBJ, glTF and Collada models m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • glTF node transform

    The matrix of a glTF node from its matrix, or from its translation, rotation and scale.

    M = T · R(q) · S

    Import of OBJ, glTF and Collada models m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • glTF vertex in the model

    A glTF vertex moved by its node transforms and turned to Z up.

    p′ = M · p, then (x, y, z) → (x, −z, y)

    Import of OBJ, glTF and Collada models m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Collada numbers

    How lists of numbers in a Collada file are read.

    Import of OBJ, glTF and Collada models m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Collada unit and up axis

    The change from the file's unit and up axis to Z-up meters.

    C = R_up · S(meter); node matrix → C · M · C⁻¹; point → C · p

    Import of OBJ, glTF and Collada models m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Collada node transforms

    The matrix of a Collada node from its matrix, translate, rotate and scale elements.

    rotate: angle in radians = degrees × π ÷ 180

    Import of OBJ, glTF and Collada models m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Collada vertex in the model

    A Collada vertex turned to Z-up meters.

    p′ = C · p

    Import of OBJ, glTF and Collada models m3d/io.js
    • CadCraft
    • ModelCraft
    64-bit
  • Arc of a glyph

    The points of the round parts of letters.

    n = max(2, ⌈|a₁ − a₀| ÷ 15⌉); p = (c_x + r_x cos a, c_y + r_y sin a)

    Text from drawings as stroked edges m3d/strokefont.js
    • CadCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Width of a string

    The advance of a string in drawing units, used to align and wrap text.

    width = (Σ (glyph width + 2) − 2) × h ÷ 9 × width factor

    Text from drawings as stroked edges m3d/strokefont.js
    • CadCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Strokes of a string

    The polylines of a string at a given height, width factor and slant.

    x = x₀ + p_x × s_x + p_y × s × tan(oblique); y = p_y × s; s = h ÷ 9

    Text from drawings as stroked edges m3d/strokefont.js
    • CadCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Day of the year

    The day number of a date.

    N = days before the month + day (+1 after February in a leap year)

    Sun position for shadows m3d/sun.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    Exact
  • Equation of time and declination

    How far sun time runs ahead of clock time, and the sun's angle above the equator, for the date.

    γ = 2π ÷ (365 or 366) × (N − 1 + (hour − 12) ÷ 24); eqtime = 229.18 × (0.000075 + 0.001868 cos γ − 0.032077 sin γ − 0.014615 cos 2γ − 0.040849 sin 2γ)

    Sun position for shadows m3d/sun.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • Hour angle and altitude

    The sun's height above the horizon.

    tst = hour × 60 + eqtime + 4 × lon − 60 × tz; H = tst ÷ 4 − 180°; cos Z = sin φ sin δ + cos φ cos δ cos H; altitude = 90° − Z

    Sun position for shadows m3d/sun.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • Azimuth

    The sun's compass direction, in degrees clockwise from north.

    azimuth = atan2(sin H, cos H sin φ − tan δ cos φ) + 180°, wrapped to 0…360

    Sun position for shadows m3d/sun.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • Direction toward the sun

    The unit vector shadows are cast from, in model axes (north is +Y, east is +X).

    dir = (sin a cos alt, cos a cos alt, sin alt)

    Sun position for shadows m3d/sun.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • Unit constants

    The Boltzmann constant, Coulomb constant, acceleration factor and pressure factor for reduced and real units.

    real: kB = 0.0019872041 kcal/mol/K; ke = 332.0637; accel = 418.4; pressure = 68568.4 atm per kcal/mol/ų

    Molecular dynamics molecular/md.js
    • CadCraft
    • BimCraft
    64-bit
  • Complementary error function

    erfc(x), used for the real-space part of the Ewald sum.

    erfc(x) ≈ t × exp(−x² + P₉(t)), t = 1 ÷ (1 + |x| ÷ 2); 2 − that for x < 0

    Molecular dynamics molecular/md.js
    • CadCraft
    • BimCraft
    64-bit
  • Pair parameters and the cutoff shift

    σ and ε for each pair of atom types and the energy subtracted so the pair energy is zero at the cutoff.

    σᵢⱼ = (σᵢ + σⱼ) ÷ 2; εᵢⱼ = √(εᵢ εⱼ); shift = 4 εᵢⱼ (s² − s), s = (σᵢⱼ ÷ r_c)⁶

    Molecular dynamics molecular/md.js
    • CadCraft
    • BimCraft
    64-bit
  • Kinetic energy

    The kinetic energy of the system in its energy unit.

    KE = ½ Σ mᵢ (vx² + vy² + vz²) ÷ accel

    Molecular dynamics molecular/md.js
    • CadCraft
    • BimCraft
    64-bit
  • Temperature

    The instantaneous temperature from the kinetic energy.

    T = 2 KE ÷ (dof × kB), dof = max(1, 3N − 3 − constraints)

    Molecular dynamics molecular/md.js
    • CadCraft
    • BimCraft
    64-bit
  • Pair forces and energies

    The Lennard-Jones and real-space Coulomb force, energy and virial of one pair of atoms.

    U = 4ε(s⁶² − s⁶) − shift, s⁶ = (σ² ÷ r²)³; Coulomb: ke qᵢqⱼ erfc(αr) ÷ r; excluded pairs: −ke qᵢqⱼ erf(αr) ÷ r

    Molecular dynamics molecular/md.js
    • CadCraft
    • BimCraft
    64-bit
  • Bond stretch

    The energy, force and virial of each harmonic bond.

    U = ½ k (r − r₀)²; F = −k (r − r₀) ÷ r along the bond

    Molecular dynamics molecular/md.js
    • CadCraft
    • BimCraft
    64-bit
  • Bond angles

    The energy, forces and virial of each harmonic angle.

    θ = acos(a·b ÷ (|a||b|)); U = ½ k (θ − θ₀)²; dU/dcos = −k (θ − θ₀) ÷ sin θ

    Molecular dynamics molecular/md.js
    • CadCraft
    • BimCraft
    64-bit
  • Dihedral angles

    The energy and forces of each periodic dihedral.

    φ = atan2(|b₂| b₁·n₂, n₁·n₂); U = k_d (1 + cos(nφ − δ))

    Molecular dynamics molecular/md.js
    • CadCraft
    • BimCraft
    64-bit
  • Ewald reciprocal sum and self term

    The long-range part of the Coulomb energy and force.

    E = (2π ke ÷ V) Σ_k exp(−k² ÷ 4α²) ÷ k² × |S(k)|², |n|² ≤ kmax²; self = −ke α ÷ √π × Σ q²

    Molecular dynamics molecular/md.js
    • CadCraft
    • BimCraft
    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.