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

  • 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
  • Render buffers of a definition

    The triangles of a definition's shown faces as position, normal and texture-coordinate buffers.

    Scene handed to the renderer render-mc.js
    • ModelCraft
    32-bit, display only
  • Height from a baked displacement map

    The displacement height at a texture coordinate.

    bilinear blend of the four texels round (u, v), wrapping at the edges, read at texel centers

    Scene handed to the renderer render-mc.js
    • ModelCraft
    32-bit, display only
  • Displaced mesh point

    Moves a mesh point along its averaged normal by the material's height times its scale, for the render.

    p′ = p + n̂ × height(u, v) × scale

    Scene handed to the renderer render-mc.js
    • ModelCraft
    32-bit, display only
  • 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
  • Sunrise, sunset and solar noon

    The clock hours of sunrise, sunset and solar noon and the sun's highest altitude on a day.

    hᵢ = min(0.05·i, 23.99), i = 0 … 480; rise = first hᵢ with altitude > 0 after one ≤ 0; noon = hᵢ of the highest altitude

    Time of day, date and exposure from plain words scene-say.js
    • ModelCraft
    64-bit
  • Clock hour for a named time

    The hour that stands for dawn, morning, noon, afternoon, golden hour, dusk or night on a given day.

    dawn = rise + 0.3; morning = rise + 0.45·(noon − rise); afternoon = noon + 0.55·(set − noon); dusk = set − 0.1; night = set + 2; hour = round to 0.01

    Time of day, date and exposure from plain words scene-say.js
    • ModelCraft
    64-bit
  • The look for the choices made

    Combines time, date or season and weather into the sun's date and hour and the render's exposure.

    month, day = round(given); exposure = round((weather + time of day) × 100) ÷ 100

    Time of day, date and exposure from plain words scene-say.js
    • ModelCraft
    64-bit
  • Places things can stand on

    Top-level placements and large flat faces with their box, top height, height and area.

    placement area = Δx × Δy of its box; face area from the model kernel; every number rounded to 0.001

    Placing scene trees and people scene-entourage.js
    • ModelCraft
    64-bit
  • Point inside a face outline

    Whether a plan point lies inside a polygon.

    count edges with (y_a > y) ≠ (y_b > y) and x < (x_b − x_a)·(y − y_a) ÷ (y_b − y_a) + x_a; inside if odd

    Placing scene trees and people scene-entourage.js
    • ModelCraft
    64-bit
  • The ground a request names

    The region to scatter over, the height things stand at, and the boxes to keep clear.

    on a placement: its box in plan, z = top of the box; on a face: its outline, z = first point's z; avoid boxes with top > z + 0.3 and bottom < z + 2.5

    Placing scene trees and people scene-entourage.js
    • ModelCraft
    64-bit
  • Planting trees

    Places a number of trees over the region, each with a random turn and a size within 10% of the library's.

    minimum distance = max(0.5, 0.9 × crown width); yaw = rand × 2π; scale = 0.9 + 0.2 × rand

    Placing scene trees and people scene-entourage.js
    • ModelCraft
    64-bit
  • Placing people

    Places figures over the region; along a line they face along it, half each way.

    heading = atan2(Δy, Δx) of the line; yaw = heading + π ÷ 2 (+ π for half of them) + (rand − ½) × 0.3; scale = 0.97 + 0.06 × rand

    Placing scene trees and people scene-entourage.js
    • ModelCraft
    64-bit
  • Scattering points with a minimum spacing

    Seeded points inside a rectangle or along a line, none closer than the minimum distance to another.

    rectangle: x = x₀ + margin + rand × w, y likewise; line: p = a + (b − a) × i ÷ (count − 1) + normal × jitter; kept x, y = round to 0.01

    Placing scene trees and people scene-say.js
    • ModelCraft
    64-bit
  • Placement matrix

    The 4×4 matrix for a turn about the vertical axis, a uniform scale and a position.

    c = cos(yaw)·scale; s = sin(yaw)·scale; columns [c, s, 0], [−s, c, 0], [0, 0, scale], [x, y, z]

    Placing scene trees and people scene-say.js
    • ModelCraft
    64-bit
  • Arc and circle as straight segments

    The ground segments for one traced line, arc or circle.

    aₖ = a₀ + sweep × k ÷ n; pₖ = [cx + r·cos aₖ, cy + r·sin aₖ, 0]

    Traced sketch into model edges sketch-photo-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
  • 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
  • Did another program change the points

    Decides whether a definition's native USD points still match the model's own.

    changed if any fround(own coordinate) ≠ file coordinate, or the counts differ

    USD save, open and import usd-modelcraft.js
    • ModelCraft
    Exact
  • Mesh from the native points

    Rebuilds a definition that was changed elsewhere from the file's native points and faces.

    USD save, open and import usd-modelcraft.js
    • ModelCraft
    64-bit
  • Was a placement moved elsewhere

    Decides whether a placement's matrix in the file differs from the model's and takes the file's if so.

    moved if any |mₖ(file) − mₖ(own)| > 10⁻⁷ × max(1, |mₖ(own)|)

    USD save, open and import usd-modelcraft.js
    • ModelCraft
    64-bit
  • Placements through the stage's frame

    Brings a placement matrix from the file's units and up axis into meters with Z up.

    M′ = F · M · F⁻¹

    USD save, open and import usd-modelcraft.js
    • ModelCraft
    64-bit
  • Imported mesh points

    The points of an imported mesh in meters with Z up.

    p′ = F · p (rotation, scale and translation of the frame)

    USD save, open and import usd-modelcraft.js
    • ModelCraft
    64-bit
  • Lamp output from a USD light

    The lumens of an imported lamp when the file does not carry ModelCraft's own value.

    area = width × height × scale² or 4π·(radius × scale)²; lumens = intensity × 2^exposure × 683 × max(area, 10⁻⁶) × π

    USD save, open and import usd-modelcraft.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
  • A placement's surface in world coordinates

    Every triangle corner of the selected object with its normal and UV, in world coordinates, for the bake.

    Texture bake inputs ws-shading.js
    • ModelCraft
    32-bit, display only
  • Bake ray distance and widths

    The ray distance, curvature width and cage distance handed to the bake.

    dist = given, or 0.25 × bounding box diagonal; width = percent ÷ 100; cage = percent ÷ 100

    Texture bake inputs ws-shading.js
    • ModelCraft
    32-bit, display only

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.