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

  • Cleaning a loop

    Checks a loop's points, clamps them to the patch and drops repeats.

    refused when |area| < 1e-14·(u range)·(v range)

    Trimmed surfaces: loops, cut tessellation and area nurbs/trim.js
    • ModelCraft
    • PartCraft
    64-bit
  • Circle loop

    A circular trim loop given by a center and radius as shares of the parameter range.

    pointᵢ = [u_a + (u_b − u_a)·(u + r·cos aᵢ), v_a + (v_b − v_a)·(v + r·sin aᵢ)], aᵢ = 2π·i ÷ n

    Trimmed surfaces: loops, cut tessellation and area nurbs/trim.js
    • ModelCraft
    • PartCraft
    64-bit
  • Loop from a curve on the surface

    Projects a closed 3D curve into the surface's (u, v) plane as a trim loop.

    256 points of the curve, each → closest point (u, v) on the surface

    Trimmed surfaces: loops, cut tessellation and area nurbs/trim.js
    • ModelCraft
    • PartCraft
    64-bit
  • Moving loop points off grid lines

    Shifts loop points that fall on a tessellation grid line, and keeps all of them inside the patch.

    d = 1e-6 × parameter range; a point within d ÷ 2 of a grid line moves to line + d; every point is clamped to [start + d, end − d]

    Trimmed surfaces: loops, cut tessellation and area nurbs/trim.js
    • ModelCraft
    • PartCraft
    64-bit
  • Where a loop crosses the grid

    The points where a loop segment crosses the tessellation's parameter lines.

    t = (line − p) ÷ (q − p); point = p + t·(q − p)

    Trimmed surfaces: loops, cut tessellation and area nurbs/trim.js
    • ModelCraft
    • PartCraft
    64-bit
  • Triangulating a cut cell

    Triangles for a polygon left in a grid cell after cutting.

    Trimmed surfaces: loops, cut tessellation and area nurbs/trim.js
    • ModelCraft
    • PartCraft
    64-bit
  • Area of the shown part

    The area of a trimmed surface.

    A = Σ |(b − a) × (c − a)| ÷ 2 over the triangles of the cut tessellation

    Trimmed surfaces: loops, cut tessellation and area nurbs/trim.js
    • ModelCraft
    • PartCraft
    64-bit
  • Area in the parameter plane

    The area of the shown part in (u, v).

    outer loop's area (or the whole domain) + Σ holes' signed areas

    Trimmed surfaces: loops, cut tessellation and area nurbs/trim.js
    • ModelCraft
    • PartCraft
    64-bit
  • Line buffer

    The positions of a polyline in the host's units, for drawing.

    Drawing NURBS curves and surfaces nurbs-ui/display.js
    • ModelCraft
    • PartCraft
    32-bit, display only
  • Surface mesh buffers

    The positions, normals, parameters and colors of a surface's triangles, for drawing.

    Drawing NURBS curves and surfaces nurbs-ui/display.js
    • ModelCraft
    • PartCraft
    32-bit, display only
  • Finding the sheet

    The four corners of the paper in the photo.

    corners = the pixels of the largest bright region with the smallest and largest x + y and x − y; photo position = (pixel + 0.5) × reduction factor

    Sketch photo to drawing: sheet, perspective and scale photosketch/photosketch.js
    • ModelCraft
    • CivilCraft
    64-bit
  • Perspective transform from four points

    The 3 × 3 matrix that takes four points to four others.

    8 equations in h₁…h₈ with h₉ = 1, solved by Gauss–Jordan elimination

    Sketch photo to drawing: sheet, perspective and scale photosketch/photosketch.js
    • ModelCraft
    • CivilCraft
    64-bit
  • Applying the perspective transform

    A point taken through the 3 × 3 matrix.

    w = h₆x + h₇y + h₈; x′ = (h₀x + h₁y + h₂) ÷ w; y′ = (h₃x + h₄y + h₅) ÷ w

    Sketch photo to drawing: sheet, perspective and scale photosketch/photosketch.js
    • ModelCraft
    • CivilCraft
    64-bit
  • Sheet proportions

    The long-to-short ratio of the straightened sheet.

    w = mean of top and bottom lengths, h = mean of left and right; r = max ÷ min; replaced by the named paper's ratio, or by the nearest standard ratio within 8 %

    Sketch photo to drawing: sheet, perspective and scale photosketch/photosketch.js
    • ModelCraft
    • CivilCraft
    64-bit
  • Drawing units per pixel

    The size of one pixel of the straightened sheet in drawing units, and the mapping from pixels to drawing coordinates.

    mm per px = long side in mm ÷ long side in px; units per px = mm per px × scale ÷ unit in mm; x = origin_x + px·k, y = origin_y + (height − py)·k

    Sketch photo to drawing: sheet, perspective and scale photosketch/photosketch.js
    • ModelCraft
    • CivilCraft
    64-bit
  • Arcs and circles into the drawing

    Converts each traced arc to drawing units as a circle or as an arc through its start, middle and end.

    r = r_px × units per px; circle when a₁ − a₀ ≥ 2π − 1e-6; else arc through start, middle (at (a₀ + a₁) ÷ 2) and end

    Sketch photo to drawing: sheet, perspective and scale photosketch/photosketch.js
    • ModelCraft
    • CivilCraft
    64-bit
  • Arc through three points

    The center, radius and end angles of the arc through three points.

    d = 2·(a_x(b_y − c_y) + b_x(c_y − a_y) + c_x(a_y − b_y)); center from the sums of |p|²·(differences) ÷ d; r = |a − center|

    Sketch photo to drawing: sheet, perspective and scale photosketch/paper.js
    • ModelCraft
    • CivilCraft
    64-bit
  • Placement matrix (classic files)

    A component's placement as a 4 × 4 matrix from the file's 13 doubles.

    rows of the 3 × 3 become columns; when w ≠ 1 every entry ÷ w

    SKP import: placements, texture coordinates and face loops skp/legacy.js
    • ModelCraft
    64-bit
  • Texture coordinates (classic files)

    The texture coordinates of each loop point of a textured face.

    x_r = (−n_y, n_x, 0) ÷ |(n_x, n_y)|, y_r = n × x_r; (p_x, p_y) = (p·x_r, p·y_r); uv = (p_x, p_y, 1)·M⁻¹ ÷ q ÷ tile size

    SKP import: placements, texture coordinates and face loops skp/legacy.js
    • ModelCraft
    64-bit
  • Loop normal

    The Newell normal of a face loop, used to check which way round the loop runs.

    n = Σ [(y_a − y_b)(z_a + z_b), (z_a − z_b)(x_a + x_b), (x_a − x_b)(y_a + y_b)]

    SKP import: placements, texture coordinates and face loops skp/legacy.js
    • ModelCraft
    64-bit
  • Placement matrix (2021 and later files)

    A component's placement as a 4 × 4 matrix from the file's 13 doubles.

    k = 1 ÷ w; every rotation and translation entry × k

    SKP import: placements, texture coordinates and face loops skp/vff.js
    • ModelCraft
    64-bit
  • Texture coordinates (2021 and later files)

    The texture coordinates of a point on a textured face.

    (p_x, p_y) = (p·x_r, p·y_r); without a placement: uv = (p_x ÷ tile width, p_y ÷ tile height); with one: (p_x, p_y, 1)·M⁻¹ ÷ q ÷ tile size

    SKP import: placements, texture coordinates and face loops skp/vff.js
    • ModelCraft
    64-bit
  • Outer loop and loop direction

    Chooses a face's outer loop and turns loops so that the outer runs counter-clockwise about the normal and holes clockwise.

    area(loop) = Newell(loop)·unit normal ÷ 2; outer = loop with the largest |area|

    SKP import: placements, texture coordinates and face loops skp/vff.js
    • ModelCraft
    64-bit
  • Strength of connection between nodes

    Decides which neighboring nodes are strongly coupled, from the Frobenius norms of their stiffness blocks.

    strong when ‖A_IJ‖ > θ × √(‖A_II‖ × ‖A_JJ‖), θ = 0.08

    Multigrid preconditioner for stress analysis amg.js
    • PartCraft
    64-bit
  • Tentative prolongator by QR per aggregate

    Orthonormalizes the near-null vectors (the rigid motions) restricted to each aggregate to form the columns of the prolongator.

    q_j ← b_j − Σᵢ (qᵢ·b_j) qᵢ (twice); keep when ‖q_j‖ > 1e-10 × scale × √m

    Multigrid preconditioner for stress analysis amg.js
    • PartCraft
    64-bit
  • Largest eigenvalue of D⁻¹A

    Estimates the largest eigenvalue used to set the prolongator smoothing weight.

    λ ≈ 1.05 × ‖D⁻¹A x‖ ÷ ‖x‖ after 15 power iterations

    Multigrid preconditioner for stress analysis amg.js
    • PartCraft
    64-bit
  • Prolongator smoothing

    Applies one damped Jacobi step to the tentative prolongator.

    P = P̂ − ω D⁻¹ A P̂, ω = 4 ÷ (3 λmax)

    Multigrid preconditioner for stress analysis amg.js
    • PartCraft
    64-bit
  • Sparse matrix product

    Multiplies two sparse matrices, used for A·P and Pᵀ·(A·P).

    C_ij = Σ_r A_ir × B_rj

    Multigrid preconditioner for stress analysis amg.js
    • PartCraft
    64-bit
  • Dense Cholesky on the coarsest level

    Factors the coarsest matrix and solves with it by forward and back substitution.

    L Lᵀ = A_c; pivot = √s when s > 1e-12 × max diag, else √(1e-12 × max diag + |s|)

    Multigrid preconditioner for stress analysis amg.js
    • PartCraft
    64-bit
  • Gauss–Seidel sweep

    One forward or backward relaxation sweep, the smoother of the V-cycle.

    x_r = (b_r − Σ_{c≠r} A_rc x_c) ÷ A_rr

    Multigrid preconditioner for stress analysis amg.js
    • PartCraft
    64-bit
  • V-cycle

    Applies the preconditioner: smooth, restrict the residual, solve the coarse problem, add the correction, smooth again.

    x ← S(b); r = b − A x; x ← x + P × cycle(Pᵀ r); x ← Sᵀ(b)

    Multigrid preconditioner for stress analysis amg.js
    • PartCraft
    64-bit
  • Draft angle

    The angle between a surface normal and the plane square to the pull direction, in degrees.

    angle = asin(clamp(n · pull, −1, 1)) × 180 ÷ π

    Draft and curvature analysis analysis.js
    • PartCraft
    64-bit
  • Areas by draft class

    The surface area with enough draft, with too little, and facing away from the pull.

    area = |(B − A) × (C − A)| ÷ 2; each corner adds area ÷ 3 to its class

    Draft and curvature analysis analysis.js
    • PartCraft
    32-bit in part
  • Curvature color limit

    The curvature value (1/mm) at which the colors reach full blue or red, stated in the panel with its radius.

    lim = 95th percentile of |mean curvature|; color weight = clamp(mean ÷ lim, −1, 1)

    Draft and curvature analysis analysis.js
    • PartCraft
    32-bit in part
  • View scale and position on the sheet

    Picks the drawing scale and maps view coordinates to sheet millimeters.

    scale = first s with w × s ≤ 0.78 × frame width and h × s ≤ 0.78 × frame height; sheet = origin + (u − u₀) × scale

    Assembly drawing sheet and mesh exports asm-drawing.js
    • PartCraft
    64-bit
  • Mass text in the bill of materials

    Formats a part's mass for the drawing's parts table.

    g ≥ 1000: kg with 3 decimals; else g with 2 decimals

    Assembly drawing sheet and mesh exports asm-drawing.js
    • PartCraft
    64-bit
  • Assembly as one mesh

    Moves every part's mesh to its place in the assembly and joins them, for STL export and the 3D-printing check.

    p′ = M × p for each vertex

    Assembly drawing sheet and mesh exports asm-drawing.js
    • PartCraft
    32-bit in part
  • Numbers written to 3MF

    Turns a coordinate or a matrix entry into the text stored in the 3MF file.

    text = toPrecision(9) of v; |v| < 1e-12 → 0

    Assembly drawing sheet and mesh exports asm-drawing.js
    • PartCraft
    64-bit
  • Instance placement in 3MF

    Converts each instance's placement from Y-up to Z-up and writes it as the item transform.

    T = Y_TO_Z × M × Z_TO_Y; 12 entries written row by row

    Assembly drawing sheet and mesh exports asm-drawing.js
    • PartCraft
    64-bit
  • Inverse of a rigid transform

    Inverts a rotation-plus-translation matrix.

    R⁻¹ = Rᵀ; t⁻¹ = −Rᵀ t

    Assembly joints and part placement assembly.js
    • PartCraft
    64-bit
  • Mate frame on a face

    The frame a joint end uses: the face's axes, with the origin moved to where the chosen axis crosses the face.

    o = a + d × ((f − a) · n) ÷ (d · n)

    Assembly joints and part placement assembly.js
    • PartCraft
    64-bit
  • Joint value inside its limits

    A joint's angle or distance, held between its minimum and maximum.

    value = min(max, max(min, v))

    Assembly joints and part placement assembly.js
    • PartCraft
    64-bit
  • Motion of a joint

    The transform of part B relative to part A's mate frame, from the joint's angles and distances.

    revolute, slider, cylindrical, rigid: T(0, 0, offset) × Rz(angle); planar: T(dx, dy, 0) × Rz; ball: Rx(tiltX) × Ry(tiltY) × Rz; pin-slot: T(s cos δ, s sin δ, 0) × Rz

    Assembly joints and part placement assembly.js
    • PartCraft
    64-bit
  • Placement walk and loop mismatch

    Places each part from one already placed through their joint, and measures how far a loop-closing joint is from closing.

    W_B = W_A × F_A × motion × FLIP × F_B⁻¹; off = max |want − have| (rotation entries × 100)

    Assembly joints and part placement assembly.js
    • PartCraft
    64-bit
  • Storing solved joint values

    Writes the values that close the loops into the joints, which is what the file saves.

    stored = round(v × 1e9) ÷ 1e9

    Assembly joints and part placement assembly.js
    • PartCraft
    64-bit
  • Moving a free part by hand

    Applies a typed move or rotation to a part's stored placement.

    M′ = T(move) × R(about, axis, angle) × M

    Assembly joints and part placement assembly.js
    • PartCraft
    64-bit
  • Rotation matrix to rotation vector

    Turns the rotation part of a mismatch into an axis times an angle in radians.

    θ = acos(clamp((trace − 1) ÷ 2, −1, 1)); w = (R − Rᵀ)ᵛ × θ ÷ (2 sin θ)

    Closed-loop joint solver assembly.js
    • PartCraft
    64-bit
  • Loop residuals

    For each loop-closing joint, how far its B end is from where the loop puts it.

    D = have⁻¹ × want; r = (D_x, D_y, D_z, w_x L, w_y L, w_z L)

    Closed-loop joint solver assembly.js
    • PartCraft
    64-bit
  • Jacobian by central differences

    The rate of change of every residual with every unknown joint value.

    J_qc = (r_q(x + h e_c) − r_q(x − h e_c)) ÷ 2h, h = 1e-6 × max(1, L)

    Closed-loop joint solver assembly.js
    • PartCraft
    64-bit
  • Damped least-norm Newton step

    Moves the joint values toward closing the loops while changing them as little as possible.

    dx = Jᵀ (J Jᵀ + μ D)⁻¹ (−r); accept x + α dx when Σr² falls, α = 1, ½, ¼ …

    Closed-loop joint solver assembly.js
    • PartCraft
    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.