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

  • 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
  • Scale about a point

    The matrix that scales a body by three factors about a fixed point.

    p′ = c + diag(sx, sy, sz) × (p − c); translation = c × (1 − s)

    Body move, scale and path pattern arithmetic bodies.js
    • PartCraft
    64-bit
  • Smallest rotation between two directions

    The rotation that turns one unit direction onto another by the smallest angle.

    k = (a × b) ÷ |a × b|; θ = atan2(|a × b|, a · b)

    Body move, scale and path pattern arithmetic bodies.js
    • PartCraft
    64-bit
  • Rotation about an axis

    The 3 × 3 rotation about a unit axis by an angle in radians.

    R = cos θ I + sin θ [k]× + (1 − cos θ) k kᵀ

    Body move, scale and path pattern arithmetic bodies.js
    • PartCraft
    64-bit
  • Rigid motion about a point

    The 4 × 4 matrix of a rotation about a point followed by a translation.

    p′ = R (p − c) + c + t; offset = c − R c + t

    Body move, scale and path pattern arithmetic bodies.js
    • PartCraft
    64-bit
  • Pattern stations along a path

    The arc length at which each copy of a path pattern sits.

    equal: step = L ÷ count (closed) or room ÷ (count − 1) (open); s_i = s₀ ± step × i, wrapped into [0, L) on a closed path

    Body move, scale and path pattern arithmetic bodies.js
    • PartCraft
    64-bit
  • Rib slab outline

    The flat region the rib is cut from: the sketch chain carried past both ends and offset to one side.

    E = 4 × max(1, diagonal + |box center − sketch origin|); ends ± E along the end directions; far side = + E × D

    Rib feature brep-rib.js
    • PartCraft
    64-bit
  • Choosing the rib piece

    Picks the piece of the trimmed slab that lies beside the sketch line and checks it is closed off by the body.

    distance(probe, piece) < 1e-6 × max(1, t); open when reach > 0.5 × E

    Rib feature brep-rib.js
    • PartCraft
    64-bit
  • Edge flange frame

    The axes a flange is built in: along the edge, out of the sheet's face, and out of its side.

    e = unit(B − A); square when |n_big · n_side| ≤ 1e-6; P = (A + B) ÷ 2 − v × t ÷ 2 must lie on the side face

    Sheet metal base and edge flanges brep-sheet.js
    • PartCraft
    64-bit
  • Flange cross-section

    The corner points of the bend and the leg in the plane square to the edge.

    C = (0, r); point(ρ, φ) = C + ρ (cos φ, sin φ); φ from −π ÷ 2 to −π ÷ 2 + θ; leg end = arc end + length × (−sin φ₁, cos φ₁)

    Sheet metal base and edge flanges brep-sheet.js
    • PartCraft
    64-bit
  • Bend relief slot

    The box cut beside an offset flange end so the bend can form.

    depth into the sheet = r + t; box length along u = (r + t) + 1e-3 × max(1, r + t); through 2 × t

    Sheet metal base and edge flanges brep-sheet.js
    • PartCraft
    64-bit
  • Side of the first bend

    Which side of an open profile the sheet's thickness goes on.

    turn = sign((p₁ − p₀) × (p₂ − p₁))

    Sheet metal base and edge flanges brep-sheet.js
    • PartCraft
    64-bit
  • Cone from its derivatives

    A cone's axis point, axis direction, radius and slope from the surface's derivatives at one point.

    ρ = |P_uu|; e = −P_uu ÷ ρ; z = P_v − (P_v · e) e; axis point = P − ρ e; slope k = (P_v · e) ÷ |z|

    Exact surface records for meshing brep-surf.js
    • PartCraft
    64-bit
  • Torus from its derivatives

    A torus's center, axis and two radii from the surface's derivatives at one point.

    ρ = |P_uu|; A = P − ρ e; d = unit(e × P_u); tube center M = P + P_vv; c = A + ((M − A) · d) d; R = |M − c|; r = |P_vv|

    Exact surface records for meshing brep-surf.js
    • PartCraft
    64-bit
  • Check against the kernel's face

    Confirms the record describes the same surface as the kernel's face before it is used.

    25 points on a 5 × 5 grid (2 % to 98 % of the parameter box); each within 1e-9 × size of the record's surface

    Exact surface records for meshing brep-surf.js
    • PartCraft
    64-bit
  • Closed loops with their curves

    Collects a sketch's curves into closed loops, keeping each curve's exact definition.

    tol = 1e-6 × max(1, extent); ends within 10 × tol share a node; arc mid = c + r (cos, sin)(a₀ + sweep ÷ 2)

    Sketch profiles for exact solids brep.js
    • PartCraft
    64-bit
  • Arc edge through three points

    Builds an arc of the profile in the kernel.

    arc through a (start node), mid, b (end node)

    Sketch profiles for exact solids brep.js
    • PartCraft
    64-bit
  • Loop orientation

    Whether a loop runs counterclockwise, from the sign of its area.

    A = ½ Σ (x_j y_i − x_i y_j)

    Sketch profiles for exact solids brep.js
    • PartCraft
    64-bit
  • Point just inside a loop

    A test point a small step inside the loop's longest edge, used to decide nesting.

    p = midpoint of longest edge + normal × 1e-6 × max(1, edge length)

    Sketch profiles for exact solids brep.js
    • PartCraft
    64-bit
  • Which loops are holes

    Counts how many other loops contain each loop; odd depth is a hole.

    depth_i = number of loops whose polygon contains innerPoint(loop_i); face when depth is even

    Sketch profiles for exact solids brep.js
    • PartCraft
    64-bit
  • Stored edge and face reference points

    The point saved with a picked edge or face so it can be found again after a rebuild.

    at = coordinates rounded to 6 decimals

    Sketch profiles for exact solids brep.js
    • PartCraft
    64-bit
  • Extrude depth and start

    Where an extrude starts and how far it runs for blind, mid-plane and through-all ends.

    blind: z₀ = 0 or −h; mid: z₀ = −h ÷ 2; through: h = far side + 1 + 0.01 × body range

    Exact-kernel feature dimensions brep.js
    • PartCraft
    64-bit
  • Revolve axis checks

    Checks that the axis lies in the sketch plane and that the profile stays on one side of it.

    side s = −u_y (p_x − a_x) + u_x (p_y − a_y); crosses when some s > 1e-7 × scale and some s < −1e-7 × scale

    Exact-kernel feature dimensions brep.js
    • PartCraft
    64-bit
  • Revolve angle

    The sweep angle given to the kernel.

    full turn when |angle − 360| < 1e-9; else angle × π ÷ 180

    Exact-kernel feature dimensions brep.js
    • PartCraft
    64-bit
  • Through-hole depth

    How deep a through hole is drilled.

    depth = distance to the body's far side + 1 + 0.01 × body range

    Exact-kernel feature dimensions brep.js
    • PartCraft
    64-bit
  • Countersink depth

    How deep the cone of a countersunk hole goes.

    h = (D_csink − d) ÷ 2 ÷ tan(angle × π ÷ 360)

    Exact-kernel feature dimensions brep.js
    • PartCraft
    64-bit
  • Cosmetic thread radii

    The major and minor radius recorded for a tapped hole's thread.

    r₁ = D ÷ 2; r₀ = min(tap drill, D − 1.082532 × P) ÷ 2

    Exact-kernel feature dimensions brep.js
    • PartCraft
    64-bit
  • Linear pattern positions

    Where each copy of a linear pattern sits.

    copy i moved by direction × spacing × i

    Exact-kernel feature dimensions brep.js
    • PartCraft
    64-bit
  • Circular pattern angles

    The angle of each copy of a circular pattern.

    full circle: step = 360 ÷ count; otherwise step = angle ÷ (count − 1); copy i turned by step × i

    Exact-kernel feature dimensions brep.js
    • PartCraft
    64-bit
  • Shell wall offset

    Hollows a body to a wall thickness.

    offset = +t (outward) or −t; kernel tolerance 1e-3

    Exact-kernel feature dimensions brep.js
    • PartCraft
    64-bit
  • Fillet and chamfer sizes

    The radius, distances or distance and angle given to the kernel for each picked edge.

    two distances: (d, d₂); distance and angle: (d, angle × π ÷ 180); fillet: r, or (r, r₂) along the edge

    Exact-kernel feature dimensions brep.js
    • PartCraft
    64-bit
  • Sewing an imported surface model

    Joins the faces of a STEP file that has no solid into a closed shell.

    sewing tolerance = 1e-6

    Exact-kernel feature dimensions brep.js
    • PartCraft
    64-bit
  • Length of a line or arc

    The length of one piece of an outline or toolpath.

    line: |e − s|; arc: |sweep| × r

    2D curve offsets for toolpaths cam-offset.js
    • PartCraft
    64-bit
  • Point along a piece

    The point a given fraction of the way along a line or arc.

    line: s + (e − s) t; arc: c + r (cos, sin)(a₀ + sweep × t)

    2D curve offsets for toolpaths cam-offset.js
    • PartCraft
    64-bit
  • Is an angle on an arc

    Whether a direction from the center falls within an arc, and how far along.

    u = mod(±(a − a₀), 2π); on the arc when u ≤ |sweep| + eps; t = u ÷ |sweep|

    2D curve offsets for toolpaths cam-offset.js
    • PartCraft
    64-bit
  • Distance from a point to a line or arc

    The shortest distance from a point to one piece of an outline.

    line: |q − (s + d × clamp(((q − s) · d) ÷ |d|², 0, 1))|; arc: ||q − c| − r| when the direction is on the arc, else the nearer end

    2D curve offsets for toolpaths cam-offset.js
    • PartCraft
    64-bit
  • Signed area of a loop

    The area enclosed by a loop of lines and arcs, positive when counterclockwise.

    A = ½ Σ [line: s × e; arc: r c_x (sin a₁ − sin a₀) − r c_y (cos a₁ − cos a₀) + r² × sweep]

    2D curve offsets for toolpaths cam-offset.js
    • PartCraft
    64-bit
  • Winding number

    How many times the loops wind round a point, which says whether the point is inside.

    count signed crossings of a ray to +x; arc crossing at x = c_x ± √(r² − (q_y − c_y)²)

    2D curve offsets for toolpaths cam-offset.js
    • PartCraft
    64-bit
  • Line and line

    The point where two line pieces cross, or the ends of their overlap when they lie on one line.

    t_a = ((B.s − A.s) × s) ÷ (r × s); parallel when |r × s| ≤ 1e-12 |r| |s|

    2D curve offsets for toolpaths cam-offset.js
    • PartCraft
    64-bit
  • Line and arc

    The points where a line piece meets an arc.

    a t² + b t + c = 0; t = (−b ± √(b² − 4ac)) ÷ 2a

    2D curve offsets for toolpaths cam-offset.js
    • PartCraft
    64-bit
  • Arc and arc

    The points where two arcs meet.

    a = (r_A² − r_B² + d²) ÷ 2d; h = √(r_A² − a²); p = c_A + a u ± h n

    2D curve offsets for toolpaths cam-offset.js
    • PartCraft
    64-bit
  • Raw offset of a loop

    Moves every piece of a loop sideways by the offset and joins the corners with arcs.

    line: s, e + d × left normal; arc: r ∓ d; corner arc radius d, sweep = atan2(t_a × t_b, t_a · t_b)

    2D curve offsets for toolpaths cam-offset.js
    • PartCraft
    64-bit
  • Splitting pieces at intersections

    Cuts every offset piece where it meets another.

    cut at parameter t unless within 1e-5 mm of an end or of the previous cut

    2D curve offsets for toolpaths cam-offset.js
    • PartCraft
    64-bit
  • Offset of a region

    The outline at a fixed distance inside or outside a region, which is the path of the tool center.

    keep a piece when dist(midpoint, original outline) ≥ d − 1e-6 and the midpoint is on the offset side

    2D curve offsets for toolpaths cam-offset.js
    • PartCraft
    64-bit
  • Chaining pieces into loops

    Joins the kept pieces end to start into closed loops.

    next piece starts within 4e-5 mm of the current end; sharpest left turn wins; then next.start = current.end

    2D curve offsets for toolpaths cam-offset.js
    • PartCraft
    64-bit
  • Merging collinear lines and co-circular arcs

    Joins neighboring pieces that lie on the same line or circle into one.

    lines: |u × v| < 1e-10 and end within 1e-9 mm of the line; arcs: centers and radii within 1e-9 mm, same direction

    2D curve offsets for toolpaths cam-offset.js
    • PartCraft
    64-bit
  • Splitting arcs to half turns

    Cuts arcs so none sweeps more than 180°, as G-code controls expect.

    n = ceil(|sweep| ÷ π); piece i from a₀ + sweep × i ÷ n

    2D curve offsets for toolpaths cam-offset.js
    • PartCraft
    64-bit
  • Points along a piece at a chord tolerance

    Sample points no farther than a tolerance from an arc, for checks and drawing.

    step angle = 2 acos(1 − tol ÷ r)

    2D curve offsets for toolpaths cam-offset.js
    • PartCraft
    64-bit
  • Bounding box of a piece

    The extent of a line or arc, including where an arc bulges past its ends.

    ends, plus c ± r along each axis direction the arc passes

    2D curve offsets for toolpaths cam-offset.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.