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

  • Room from a floor face

    The outline, holes, height and area of a room from a level face that looks up.

    floor if n_z > 0.999; plan = model point × 1000; area (m²) = (outer − Σ holes) ÷ 10⁶

    Room outline and furniture placement furnish-mc.js
    • ModelCraft
    64-bit
  • Doors and windows near the room

    Which starter doors and windows belong to the room, with their middle, width and sill height in millimeters.

    middle = box center × 1000; width = max(Δx, Δy) × 1000; near if distance to outline ≤ 400

    Room outline and furniture placement furnish-mc.js
    • ModelCraft
    64-bit
  • Placement matrix for a piece

    The matrix that lays a furniture piece on the planner's footprint.

    x axis = (fp₁ − fp₀) ÷ 1000 ÷ W; y axis = (fp₃ − fp₀) ÷ 1000 ÷ D; origin = fp₀ ÷ 1000 − x axis·min.x − y axis·min.y; z = floor − min.z

    Room outline and furniture placement furnish-mc.js
    • ModelCraft
    64-bit
  • Reading position and turn

    The x, y, z and turn a control program reads for a placement.

    x, y, z = m[12], m[13], m[14]; rotZ = atan2(m[1], m[0]) × 180 ÷ π

    Control program host: placement position and turn plc-scene-mc.js
    • ModelCraft
    64-bit
  • Writing position and turn

    Applies the values a control program set to the placement's matrix when the run is kept.

    sx = √(m₀² + m₁²); sy = √(m₄² + m₅²); a = rotZ × π ÷ 180; m₀ = sx·cos a, m₁ = sx·sin a, m₄ = −sy·sin a, m₅ = sy·cos a

    Control program host: placement position and turn plc-scene-mc.js
    • ModelCraft
    64-bit
  • Triangle normals, areas and boxes

    The unit normal, area and bounding box of every triangle, and the size of the whole mesh.

    n = (b − a) × (c − a); area = |n| ÷ 2; unit normal = n ÷ |n|

    Rays and distances on a printer mesh print-geom.js
    • ModelCraft
    • PartCraft
    64-bit
  • Nearest face along a ray

    The distance to the first triangle a ray meets between two limits, and whether it meets it from behind.

    det = e₁·(d × e₂); u = (s·(d × e₂)) ÷ det; v = (d·(s × e₁)) ÷ det; t = (e₂·(s × e₁)) ÷ det

    Rays and distances on a printer mesh print-geom.js
    • ModelCraft
    • PartCraft
    64-bit
  • Ray and box

    Whether a ray passes through a box within the current distance limits.

    t_near = (min − o) × (1 ÷ d); t_far = (max − o) × (1 ÷ d), per axis

    Rays and distances on a printer mesh print-geom.js
    • ModelCraft
    • PartCraft
    64-bit
  • Point to triangle distance

    The squared distance from a point to the closest point of one triangle.

    closest point q by the corner, edge and face regions; d² = |p − q|²

    Rays and distances on a printer mesh print-geom.js
    • ModelCraft
    • PartCraft
    64-bit
  • Distance to the nearest face

    The distance from a point to the nearest triangle within a search radius.

    d = √(min over triangles of d²), limited to r

    Rays and distances on a printer mesh print-geom.js
    • ModelCraft
    • PartCraft
    64-bit
  • Welding corners

    Joins corners that lie within the tolerance of each other and drops triangles that collapse.

    join if |Δx| ≤ tol and |Δy| ≤ tol and |Δz| ≤ tol; drop if two corners are the same or |n|² ≤ (tol² × 0.01)²

    Print check: weld, volume, area and intersections print3d.js
    • ModelCraft
    • PartCraft
    64-bit
  • Volume, area, overhang and bed contact

    Each shell's volume, the total surface area, the area that needs support and the area lying on the bed.

    area = Σ |n| ÷ 2; V_shell = Σ a·(b × c) ÷ 6; overhang if n_z ÷ |n| < −cos((90 − angle)·π ÷ 180)

    Print check: weld, volume, area and intersections print3d.js
    • ModelCraft
    • PartCraft
    64-bit
  • A shell inside another shell

    Decides whether an inside-out shell is a hollow inside another shell, which is correct, or a real fault.

    ray from one corner along [0.000123, 0.000457, 1]; inside if it crosses the other shells an odd number of times

    Print check: weld, volume, area and intersections print3d.js
    • ModelCraft
    • PartCraft
    64-bit
  • Ray and triangle

    The distance along a ray to a triangle, or −1 when it misses.

    det = e₁·(d × e₂); u = s·(d × e₂) ÷ det; v = d·(s × e₁) ÷ det; t = e₂·(s × e₁) ÷ det

    Print check: weld, volume, area and intersections print3d.js
    • ModelCraft
    • PartCraft
    64-bit
  • Finding triangle pairs to test

    Finds pairs of triangles whose boxes overlap and counts those that cross, within one shell and between shells.

    eps = diagonal × 10⁻⁹; boxes grown by eps; pair tested with tolerance 10 × eps

    Print check: weld, volume, area and intersections print3d.js
    • ModelCraft
    • PartCraft
    64-bit
  • Do two triangles cross

    Whether two triangles pass through each other, more than touching.

    signed distances of each triangle's corners to the other's plane, set to 0 within eps; overlap of the two intervals on the planes' common line must exceed eps

    Print check: weld, volume, area and intersections print3d.js
    • ModelCraft
    • PartCraft
    64-bit
  • Triangles in the same plane

    Whether two triangles in one plane overlap.

    2D orientation tests on the projection that drops the normal's largest axis; crossing edges, or one centroid inside the other

    Print check: weld, volume, area and intersections print3d.js
    • ModelCraft
    • PartCraft
    64-bit
  • Total volume and bed fit

    The volume reported for a mesh without problems, and the warnings for a tiny model or one larger than the bed.

    V = Σ shell volumes (hollows are negative); fits if sizeₖ ≤ bedₖ + 10⁻⁹, as given or with x and y swapped

    Print check: weld, volume, area and intersections print3d.js
    • ModelCraft
    • PartCraft
    64-bit
  • Flat area per color

    The total area of level, upward faces of each color, largest first.

    s = ∛|m₀·(m₅·m₁₀ − m₆·m₉)|; area = Σ face area × s²; shown = round(area × 100) ÷ 100

    Areas of flat upward faces by color render-mc.js
    • ModelCraft
    64-bit
  • Picked points in millimeters

    The picked model points as the surfaces library receives them.

    v_mm = round(v × 1000 × 10⁶) ÷ 10⁶

    Points picked for surfaces surfaces-mc.js
    • ModelCraft
    64-bit
  • Round starting size

    Rounds a size to 1, 2, 5 or 10 times a power of ten.

    p = 10^⌊log₁₀ x⌋; m = x ÷ p; result = (1 if m < 1.5, 2 if m < 3.5, 5 if m < 7.5, else 10) × p

    Sizes for new curves and meshes, remesh grid ws-curve.js
    • ModelCraft
    64-bit
  • Text as a curve object

    The letters' outlines as closed flat splines, filled and given a thickness.

    extrude = height × 0.05; each outline point [x, y] becomes a spline point [x, y, 0]

    Sizes for new curves and meshes, remesh grid ws-curve.js
    • ModelCraft
    64-bit
  • Voxel remesh grid size

    Suggests a voxel size and counts the grid cells the typed size would need.

    suggested = niceSize(largest extent ÷ 40); cells = Π (⌈(extentₖ + 4·voxel) ÷ (voxel ÷ 2)⌉ + 1)

    Sizes for new curves and meshes, remesh grid ws-mesh.js
    • ModelCraft
    64-bit
  • Size of a new mesh shape

    The size given to a new plane, cube, cylinder, sphere or torus.

    s = niceSize(view height ÷ 5); radius = s ÷ 2; torus tube = s ÷ 8

    Sizes for new curves and meshes, remesh grid ws-mesh.js
    • ModelCraft
    64-bit
  • Volume and size of a placed solid

    The volume of a closed group or component and its width, depth and height as placed.

    k = ∛|det M₃ₓ₃|; volume = V × k × k × k; size_q = (max_q − min_q) × |column q|; retyped size → L ÷ |column q|

    Entity info: volume, size, angle and area modelcraft.js
    • ModelCraft
    64-bit
  • Volume and size of a placed mesh

    The volume of a closed mesh and its size as placed.

    k = ∛|det M₃ₓ₃|; volume = V × k³; size_q = (max_q − min_q) × |column q|

    Entity info: volume, size, angle and area modelcraft.js
    • ModelCraft
    64-bit
  • Arc angle

    The angle an arc sweeps, in degrees.

    shown = round(sweep × 180 ÷ π × 100) ÷ 100

    Entity info: volume, size, angle and area modelcraft.js
    • ModelCraft
    64-bit
  • Total area of selected faces

    The sum of the areas of the selected faces.

    total = Σ face area

    Entity info: volume, size, angle and area modelcraft.js
    • ModelCraft
    64-bit
  • Print check size and volume

    The size in millimeters and the volume in cubic centimeters shown after a print check.

    shown size = round(mm × 10) ÷ 10; shown volume = round(mm³ ÷ 1000 × 10) ÷ 10 cm³

    Entity info: volume, size, angle and area modelcraft.js
    • ModelCraft
    64-bit
  • Mirror plane for a flipped copy

    Puts the mirror plane on the far side of the selection's box so the copy lands beside the original.

    far = max over the box's 8 corners of (corner − c)·a; plane point = c + a × far

    Edits and settings from the main window modelcraft.js
    • ModelCraft
    64-bit
  • Curve object from a drawn curve

    Makes a curve object from a drawn arc, circle, polygon or curve, flat when all its points share a height.

    closed if |first − last| < 10⁻⁹; flat if every |z − z₀| < 10⁻⁹, then z ← 0 and the placement carries z₀; bevel depth = max(10⁻⁴, length ÷ 100)

    Edits and settings from the main window modelcraft.js
    • ModelCraft
    64-bit
  • Node meshes baked into the model

    Converts each baked mesh from millimeters to the model's meters.

    x_m = x_mm ÷ 1000

    Edits and settings from the main window modelcraft.js
    • ModelCraft
    64-bit
  • Guessing storey heights

    Proposes a storey for each different height the top-level groups and components stand on.

    height = round(box min z × 100) ÷ 100

    Edits and settings from the main window modelcraft.js
    • ModelCraft
    64-bit
  • Sun settings from the panel

    Reads month, day, hour, latitude, longitude and time zone from the Style panel into the model's sun.

    value = clamp(parseFloat(text), lo, hi); month, day = value | 0

    Edits and settings from the main window modelcraft.js
    • ModelCraft
    64-bit
  • Room handed to add-ons

    The room made by the selected floor face, as add-ons receive it: outline in millimeters, height and area.

    z = round(room height × 1000); area (mm²) = area (m²) × 10⁶

    Edits and settings from the main window modelcraft.js
    • ModelCraft
    64-bit
  • Scale of a photographed sketch

    Reads the 1 : n scale the person types for a sketch photo.

    n = round(Number(text)); accepted if 1 ≤ n ≤ 100 000

    Edits and settings from the main window modelcraft.js
    • ModelCraft
    64-bit
  • Point and normal under the pointer

    The clicked point and the face normal in the face's own coordinates, and where on the material's tile the point lies.

    p = M⁻¹ × hit; n = (b − a) × (c − a), made unit; tile uv = planar uv ÷ tile size

    Decal placement and size ws-shading.js
    • ModelCraft
    64-bit
  • Barycentric weights of a point in a triangle

    The three weights of a point against a triangle's corners and its distance from the triangle's plane.

    n = ab × ac; b = ((ap × ac) · n) ÷ |n|²; c = ((ab × ap) · n) ÷ |n|²; a = 1 − b − c; dist = |ap · n| ÷ |n|

    Decal placement and size ws-shading.js
    • ModelCraft
    64-bit
  • Size of a new decal

    The width and height a new decal and its material tile are stored with.

    height = round(width × (picture height ÷ picture width) × 1000) ÷ 1000

    Decal placement and size ws-shading.js
    • ModelCraft
    64-bit
  • Resize a decal

    A decal's new height and depth when its width is changed.

    h = round(w × size₁ ÷ size₀ × 1000) ÷ 1000; depth = max(0.01, min(w, h) ÷ 2)

    Decal placement and size ws-shading.js
    • ModelCraft
    64-bit
  • Turn a decal a quarter turn

    The decal's new width direction and swapped sizes after a quarter turn about its normal.

    u′ = n × u; size′ = [size₁, size₀]

    Decal placement and size ws-shading.js
    • ModelCraft
    64-bit
  • Center line of a conveyor

    The length of a straight, zoned, inclined or curved conveyor and the point and heading at a distance along it.

    incline: L = √(length² + rise²); curve: L = r × |angle|, point = (r sin θ, ± r (1 − cos θ)), θ = s ÷ r

    Material flow layout geometry addons/flow/lib/catalog.js
    • ModelCraft
    64-bit
  • Ports of an item

    Where an item's in, out and vehicle ports are in its own frame, with their headings.

    Material flow layout geometry addons/flow/lib/catalog.js
    • ModelCraft
    64-bit
  • Parameter limits

    Clamps each numeric parameter to its minimum and maximum and rounds whole-number parameters.

    n = min(max, max(min, v)); whole numbers: round(n)

    Material flow layout geometry addons/flow/lib/catalog.js
    • ModelCraft
    64-bit
  • Reading a layout

    Checks the positions, rotation, fleet and run settings of a saved layout.

    x, y, z: kept if finite and |v| < 1e6, else 0; rot = ((rot mod 360) + 360) mod 360

    Material flow layout geometry addons/flow/lib/layout.js
    • ModelCraft
    64-bit
  • Local point to world

    Turns a point in an item's own frame by the item's rotation and moves it to the item's position.

    x′ = x cos r − y sin r + item x; y′ = x sin r + y cos r + item y; heading = ((h mod 360) + 540) mod 360 − 180

    Material flow layout geometry addons/flow/lib/layout.js
    • ModelCraft
    64-bit
  • Placing an item on a port

    The position and rotation that put one of an item's ports on a given point with a given heading.

    rot = ((H − port heading) mod 360 + 360) mod 360; position = P − rotated port offset

    Material flow layout geometry addons/flow/lib/layout.js
    • ModelCraft
    64-bit
  • Which ports are joined

    Finds the out and in ports that touch, and merges vehicle path ends into nodes.

    joined when |Δx|, |Δy|, |Δz| ≤ 0.01 m and |Δheading| ≤ 1°; path ends merge when each |Δ| ≤ 0.05 m

    Material flow layout geometry addons/flow/lib/layout.js
    • ModelCraft
    64-bit
  • Snap an item to the nearest free port

    Moves an item so one of its free ports sits on the nearest matching free port within a radius.

    d = √(Δx² + Δy² + Δz²); nearest pair with d ≤ radius (0.5 m by default)

    Material flow layout geometry addons/flow/lib/layout.js
    • ModelCraft
    64-bit
  • Lengths and times handed to the simulation

    Turns each conveyor into its length, speed and gap, and breakdown times from hours and minutes into seconds.

    zone length = zones × zone length; mtbf (s) = hours × 3600; mttr (s) = minutes × 60

    Material flow layout geometry addons/flow/lib/layout.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.