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

  • 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
  • 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
  • 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
  • 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
  • Angle on the nearest turn

    Returns each solved angle on the turn closest to where it started, inside its limits.

    w = s₀ + ((val − s₀ + 180) mod 360) − 180

    Closed-loop joint solver assembly.js
    • PartCraft
    64-bit
  • Rank, mobility and conflicts

    Counts the independent conditions at the answer, how many values could still be set, and which loops did not close.

    mobility = unknowns − rank; conflict when max |r| of a loop > max(1000 × tol, 1e-6)

    Closed-loop joint solver assembly.js
    • PartCraft
    64-bit
  • Nearest point on an edge

    The point of an edge closest to a given point, with the tangent there.

    circle: p = c + r × unit(radial part of (q − c)); other curves: minimize |C(t) − q|²

    Reference geometry, sweep paths and extrude extents brep-design.js
    • PartCraft
    64-bit
  • Midpoint of an edge by length

    The point half way along an edge measured along the curve.

    length = Σ over 32 pieces of Σ₈ wᵢ |C′(tᵢ)| × h; bisect for length(t) = total ÷ 2

    Reference geometry, sweep paths and extrude extents brep-design.js
    • PartCraft
    64-bit
  • Where an edge crosses a plane

    The points at which an edge passes through a plane.

    g(t) = (C(t) − o) · n; bisect each sign change of g between 400 samples

    Reference geometry, sweep paths and extrude extents brep-design.js
    • PartCraft
    64-bit
  • Arc of a sweep path

    Turns a sketch arc into the three points OpenCascade builds the path arc from.

    r = |s − c|; mid = c + r × (cos, sin)((a₀ + a₁) ÷ 2), a₁ raised by 2π when a₁ ≤ a₀

    Reference geometry, sweep paths and extrude extents brep-design.js
    • PartCraft
    64-bit
  • Chaining path pieces

    Decides which curve ends meet when pieces are joined into one path.

    same when |p − q| ≤ 1e-6 × max(1, largest |end point|)

    Reference geometry, sweep paths and extrude extents brep-design.js
    • PartCraft
    64-bit
  • Sweep profile at the path's end

    Checks that the profile's plane passes through one end of the path, and which end.

    |(p − o) · n| ≤ 1e-6 × max(1, |path chord|)

    Reference geometry, sweep paths and extrude extents brep-design.js
    • PartCraft
    64-bit
  • Extrude up to a face

    How far along the extrude direction each profile point is from the target plane.

    t = ((o − x) · n) ÷ (u · n); parallel target: depth = min t; otherwise depth = 1.02 × max t + 1, then cut back by the plane

    Reference geometry, sweep paths and extrude extents brep-design.js
    • PartCraft
    64-bit
  • Through, offset and vertex extents

    The extrude depth for through-all cuts, an offset from a face, and up to a vertex.

    through: far + 1 + 0.01 × body range; offset: o = face − n × side × offset; vertex: b = (p − o) · u

    Reference geometry, sweep paths and extrude extents brep-design.js
    • PartCraft
    64-bit
  • Picking the next face

    Chooses the first face of the body that the extrude meets.

    nearest face by its lowest vertex distance along u, ties (within 1e-7 × scale) by centroid distance

    Reference geometry, sweep paths and extrude extents brep-design.js
    • PartCraft
    64-bit
  • Points along a projected edge

    Turns one edge of a view into the points its line segments join.

    circle: n = max(8, ceil(|t₁ − t₀| ÷ (π ÷ 60))); other curves: n = 96; drop a sample within 1e-7 × size of the chord

    Drawing views of the exact solid brep-draw.js
    • PartCraft
    64-bit
  • Extent of a view

    The smallest box around a view's segments, used to place and scale it.

    u₀ = min, u₁ = max over segment ends (same for v)

    Drawing views of the exact solid brep-draw.js
    • PartCraft
    64-bit
  • Section plane position

    Places the cutting plane square to a view's direction and builds the box that removes the near half.

    o = center − d (center · d) + d × at; box side = 2 × (2 × diagonal + 10)

    Drawing views of the exact solid brep-draw.js
    • PartCraft
    64-bit
  • Faces in the cutting plane

    Finds the faces created by the cut, whose outlines bound the hatched area.

    ||n · d| − 1| ≤ 1e-9 and |(p − o) · d| ≤ 1e-6 × diagonal

    Drawing views of the exact solid brep-draw.js
    • PartCraft
    64-bit
  • Cutting-plane line in the neighboring view

    The point and direction of the line that shows where the section was cut.

    along = unit(d_section × d_view); p = (o · right, o · up); dir = (along · right, along · up)

    Drawing views of the exact solid brep-draw.js
    • PartCraft
    64-bit
  • Number of steps round a circle

    How many interpolation points a round direction gets, from its effective radius.

    h = (384 × DEV ÷ R)^¼; n = ceil(2π ÷ h) rounded up to a multiple of 4, between 32 and 720

    Non-uniform scale of an exact body brep-gtrsf.js
    • PartCraft
    64-bit
  • Cubic spline through the unit circle

    The poles of a periodic cubic B-spline that passes through the circle at every knot.

    pole i = k × (cos((i − 1)h), sin((i − 1)h)), k = 6 ÷ (4 + 2 cos h), err = h⁴ ÷ 384

    Non-uniform scale of an exact body brep-gtrsf.js
    • PartCraft
    64-bit
  • Largest stretch of the map

    The largest factor by which the scale lengthens any direction, used to size the deviation.

    σ = |M x| after 60 power iterations of x ← unit(Mᵀ M x)

    Non-uniform scale of an exact body brep-gtrsf.js
    • PartCraft
    64-bit
  • Image of a curve

    A line, circle, ellipse, Bézier or B-spline curve after the scale, as a B-spline in the same parameter.

    line, Bézier, B-spline: poles ↦ T × pole (exact); circle, ellipse: T × (c + r₁ x cos + r₂ y sin) at the spline's poles

    Non-uniform scale of an exact body brep-gtrsf.js
    • PartCraft
    64-bit
  • Image of a surface

    A plane, cylinder, cone, sphere, torus, extrusion, revolution or spline surface after the scale.

    plane ↦ plane with frame from T x, T x × T y; cylinder, cone: ring(u) × (R + v sin α) + v cos α Z; sphere, torus: ring(u) × (R₁ + R₂ cos v) + R₂ sin v Z

    Non-uniform scale of an exact body brep-gtrsf.js
    • PartCraft
    64-bit
  • Inverse of a placement

    Inverts a 3 × 4 placement matrix found in the shape.

    M⁻¹ = adj(M) ÷ det(M); t⁻¹ = −M⁻¹ t

    Non-uniform scale of an exact body brep-gtrsf.js
    • PartCraft
    64-bit
  • Parameter range of straight directions

    How far a line or the straight direction of a surface must extend to cover the body.

    t₀ = ((center − o) · d) ÷ |d|²; range = t₀ ± (1.02 × D ÷ |d| + 1)

    Non-uniform scale of an exact body brep-gtrsf.js
    • PartCraft
    64-bit
  • Raised shape tolerances

    The tolerance written on every vertex, edge and face of the scaled body.

    tol = max(old, max(1e-7, 3 × largest deviation + 1e-9))

    Non-uniform scale of an exact body brep-gtrsf.js
    • PartCraft
    64-bit
  • Numbers written to the shape text

    Turns each coordinate, weight and knot into the text OpenCascade reads back.

    text = String(v); −0 → 0

    Non-uniform scale of an exact body brep-gtrsf.js
    • PartCraft
    64-bit
  • Matching equal placements

    Decides when two uses of the same curve or surface share one mapped copy.

    key = entries rounded to 1e-12, joined

    Non-uniform scale of an exact body brep-gtrsf.js
    • PartCraft
    64-bit
  • Stress at the integration points

    The six stress components at every integration point of every element, from the displacements.

    σ = D (ε − α ΔT I) per point, by the element's own routine

    Buckling load factors and thermal stress setup buckling.js
    • PartCraft
    64-bit
  • Geometric stiffness times a vector

    Applies the stress-dependent stiffness Kσ to a vector, element by element.

    y = s × Σ_elements G_e x_e on each of the three directions

    Buckling load factors and thermal stress setup buckling.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.