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

  • Product of two transforms

    Combines two affine transforms into one.

    p′ = p × M (row vectors); (m × n) applies m first

    Edits to a page's own content base-content.js
    • MarkupCraft
    64-bit
  • Inverse of a transform

    The inverse of the matrix an object is painted with.

    det = a·d − b·c; inverse = adjugate ÷ det

    Edits to a page's own content base-content.js
    • MarkupCraft
    64-bit
  • Path coordinates rewritten

    The new numbers of one path-building operator after a move, scale or turn.

    U = C × T × C⁻¹; (x′, y′) = (x, y) × U, written with at most 4 decimals

    Edits to a page's own content base-content.js
    • MarkupCraft
    64-bit
  • Matrix round a moved picture or form

    The cm matrix written before a picture or form XObject that was moved, scaled or turned.

    U = C × T × C⁻¹, six entries with at most 4 decimals

    Edits to a page's own content base-content.js
    • MarkupCraft
    64-bit
  • Is this a move at all

    Decides whether an edit's matrix changes anything.

    |M − identity| < 1e-9 on all six entries

    Edits to a page's own content base-content.js
    • MarkupCraft
    64-bit
  • Line width in the path's own units

    Converts a line width given in page units to the units of the path's own space.

    w = page width ÷ √|a·d − b·c|

    Edits to a page's own content base-content.js
    • MarkupCraft
    64-bit
  • Replacement picture fitted into the old one's box

    Scales a replacement picture to fit, centered, inside the box of the picture it replaces, keeping its own proportions.

    ia = W ÷ H; ba = box w ÷ box h; (sx, sy) = ia > ba ? (1, ba ÷ ia) : (ia ÷ ba, 1)

    Edits to a page's own content base-content.js
    • MarkupCraft
    64-bit
  • Advance of a text run as read

    How far each text-showing operator moves the text position when a page's content is read, kept so a later edit can leave the rest of the line in place.

    string: Σ (width ÷ 1000 × size + char spacing + word spacing on a single-byte space) × horizontal scale; number in TJ: −v ÷ 1000 × size × horizontal scale

    Edits to a page's own content base-content.js
    • MarkupCraft
    64-bit
  • Advance of a text run

    How far a string moves the text position, in unscaled text space.

    Σ (glyph width ÷ 1000 × size + char spacing + word spacing on a space) × horizontal scale

    Edits to a page's own content base-content.js
    • MarkupCraft
    64-bit
  • Padding after reworded text

    The adjustment written after a reworded run so the text that follows on the line does not move.

    k = −(old advance − new advance) × 1000 ÷ (size × horizontal scale)

    Edits to a page's own content base-content.js
    • MarkupCraft
    64-bit
  • Matrix of a moved text run

    The text matrix written before a text run that was moved.

    Tm′ = (Tm × C) × T × C⁻¹

    Edits to a page's own content base-content.js
    • MarkupCraft
    64-bit
  • Line position put back after a moved run

    Restores where the text line continues after a run on it was moved.

    Tm = line matrix; then advance by −(start + advance) × 1000 ÷ (size × horizontal scale)

    Edits to a page's own content base-content.js
    • MarkupCraft
    64-bit
  • A move added to an object's edits

    Adds a move, scale or turn to what an object already had.

    T′ = T_old × T_new

    Edits to a page's own content base-edit.js
    • MarkupCraft
    64-bit
  • A moved path point

    The new numbers of a path when one of its points or handles is dragged to a place on the page.

    u = p_page × (C × T)⁻¹; attached handles shift by u − u_old

    Edits to a page's own content base-edit.js
    • MarkupCraft
    64-bit
  • Drawn-in paths written to the page

    Writes paths that were drawn into the page, and the matrix of pasted content, as content stream text.

    Edits to a page's own content base-edit.js
    • MarkupCraft
    64-bit
  • A stored matrix accepted

    Checks a move matrix read from a file or autosave before it is used.

    |a·d − b·c| > 1e-9 and every |number| < 1e7

    Edits to a page's own content base-edit.js
    • MarkupCraft
    64-bit
  • Box of part of a text item

    The box on the sheet round some characters of one piece of the drawing's text.

    s = width × i ÷ n; box corners = origin + u·s + v·t, t from −0.22 to 0.9 of the size

    Text positions: search hits and the OCR text layer textsearch.js
    • MarkupCraft
    64-bit
  • Cloud round a search hit

    The box of the cloud markup placed round a found word.

    box = hit box grown by pad on each side

    Text positions: search hits and the OCR text layer textsearch.js
    • MarkupCraft
    64-bit
  • Picture scale for reading text

    The scale at which a scanned page is drawn before its text is read.

    s = min(dpi ÷ 72, maxSide ÷ max(w, h), √(maxPixels ÷ (w·h))), at least 0.05

    Text positions: search hits and the OCR text layer ocr.js
    • MarkupCraft
    64-bit
  • Matrix that places the text layer

    The matrix that puts the recognizer's text-only page onto the sheet, written into the saved PDF.

    M = viewport⁻¹ ∘ [W_px ÷ W_pt, 0, 0, −H_px ÷ H_pt, 0, H_px]

    Text positions: search hits and the OCR text layer ocr.js
    • MarkupCraft
    64-bit
  • Words placed on the sheet

    The position, direction and size of each word read from a scan, for Find and Select text.

    baseline y at x by linear interpolation along the line's baseline; size = height above the baseline ÷ 0.9

    Text positions: search hits and the OCR text layer ocr.js
    • MarkupCraft
    64-bit
  • Word count and mean confidence

    The number of words read on a page and their mean confidence, for the status line.

    conf = round(Σ confidence ÷ n)

    Text positions: search hits and the OCR text layer ocr.js
    • MarkupCraft
    64-bit
  • Box and cylinder

    A 20 mm cube and a 20 mm cylinder, standing on z = 0 and centered on the origin.

    S = 0.02; R = S ÷ 2; box: S × S square pulled up by S; cylinder: 32-sided polygon of radius R pulled up by S

    Beginner shapes, align and drop to ground beginner.js
    • ModelCraft
    64-bit
  • Cone

    A cone with a 32-sided base of radius R and its apex at height S.

    Beginner shapes, align and drop to ground beginner.js
    • ModelCraft
    64-bit
  • Sphere

    A sphere of radius R resting on z = 0, made of 12 rings of 24 faces.

    θ = π·i ÷ 12; φ = 2π·j ÷ 24; p = [R·sin θ·cos φ, R·sin θ·sin φ, R − R·cos θ]

    Beginner shapes, align and drop to ground beginner.js
    • ModelCraft
    64-bit
  • Roof

    A triangular prism: a triangle across x pulled along y from −R to +R.

    Beginner shapes, align and drop to ground beginner.js
    • ModelCraft
    64-bit
  • Align

    Moves each selected placement so the minimum, middle or maximum of its box on one axis meets that of the whole selection.

    target = lo, hi or (lo + hi) ÷ 2; move = target − own value; m[12 + axis] += move

    Beginner shapes, align and drop to ground beginner.js
    • ModelCraft
    64-bit
  • Drop to ground

    Moves each selected placement up or down so the bottom of its box is at z = 0.

    m[14] += −box.min.z

    Beginner shapes, align and drop to ground beginner.js
    • ModelCraft
    64-bit
  • Rounding to 0.1 mm

    The rounding applied to every stored mesh coordinate, plan polygon point and item size.

    r1(v) = round(v × 10) ÷ 10

    Trees, people and cars from numbers entourage.js
    • ModelCraft
    64-bit
  • Mesh point

    Adds one point to a part's mesh.

    Trees, people and cars from numbers entourage.js
    • ModelCraft
    64-bit
  • Ring loft

    Trunks, pots, limbs and conifer tiers: rings of points round an axis joined into a capped solid.

    a = 2π·i ÷ seg; p = [cx + rx·cos a, cy + ry·sin a, z]

    Trees, people and cars from numbers entourage.js
    • ModelCraft
    64-bit
  • Crown and head blobs

    Tree crowns, shrubs, rocks and heads: an icosphere scaled to an ellipsoid with a seeded bump.

    t = (1 + √5) ÷ 2; unit point p; k = 1 + bump × (2·rand − 1); point = c + p × [rx, ry, rz] × k

    Trees, people and cars from numbers entourage.js
    • ModelCraft
    64-bit
  • Wheel

    A car wheel: a 14-sided cylinder along y.

    a = 2π·i ÷ seg − π ÷ 2; p = [x + r·cos a, y, z + r·sin a]

    Trees, people and cars from numbers entourage.js
    • ModelCraft
    64-bit
  • Canopy plan symbol

    The plan outline of a tree: a 14-point irregular ring, a trunk circle and a cross.

    a = 2π·i ÷ 14; k = r × (0.86 + 0.18·rand); p = [k·cos a, k·sin a]

    Trees, people and cars from numbers entourage.js
    • ModelCraft
    64-bit
  • Library item sizes

    The width, depth and height written into the library item.

    Trees, people and cars from numbers entourage.js
    • ModelCraft
    64-bit
  • Signed polygon area

    The signed area of a plan polygon.

    area = ½ Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)

    Room outline and furniture placement furnish-mc.js
    • ModelCraft
    64-bit
  • 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
  • Inward offset of every corner

    Moves each corner inward so that every face around it moves by the wall thickness, and rejects the result where an offset would fold.

    q = p − wall × m, with n·m = 1 for every face direction n at the corner

    Hollowing a body to a wall thickness print-hollow.js
    • ModelCraft
    64-bit
  • Corner move from the face directions

    The vector m with n·m = 1 for each face direction at a corner.

    one direction: m = n; two: m = (n₁ + n₂) ÷ (1 + n₁·n₂); more: (NᵀN) m = Nᵀ1

    Hollowing a body to a wall thickness print-hollow.js
    • ModelCraft
    64-bit
  • Grid step of the distance field

    Chooses the grid step and size for the distance field.

    h = min(wall ÷ 2.5, largest size ÷ 24); h ← 1.15·h while Π(⌈sizeₖ ÷ h⌉ + 5) > maxCells; band B = wall + 2h

    Hollowing a body to a wall thickness print-hollow.js
    • ModelCraft
    64-bit
  • Signed distance field

    The distance from every grid point to the outside surface, negative where the point is deeper inside than the wall.

    d² = min over triangles of |x − closest point|², capped at B²; φ = ±√d² + wall (− inside)

    Hollowing a body to a wall thickness print-hollow.js
    • ModelCraft
    32-bit in part

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.