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

  • Arc from start, middle and end

    The signed sweep of an arc about a known center that passes from a start through a middle point to an end.

    counterclockwise when mod(a_m − a₀, 2π) < mod(a₁ − a₀, 2π); sweep = ± mod(a₁ − a₀, 2π)

    Part and stock in machine coordinates cam.js
    • PartCraft
    64-bit
  • Exact outline of a flat face

    Turns a face's mesh boundary into lines and arcs whose ends are the exact edge ends.

    mesh corner within tol of an edge end → that end; mesh run within tol of an edge circle → arc on that circle

    Part and stock in machine coordinates cam.js
    • PartCraft
    64-bit
  • Hole position, size and depth

    The center, radius, top and bottom of a round face along the tool axis, and whether it is a hole and goes through.

    c, r from the exact cylinder; top, bottom = mesh z range snapped to an edge end within tol

    Part and stock in machine coordinates cam.js
    • PartCraft
    64-bit
  • Chaining picked edges into a loop

    Orders picked edges into one closed outline and makes each start exactly on the previous end.

    ends join when closer than tol; then next.start = previous.end

    Part and stock in machine coordinates cam.js
    • PartCraft
    64-bit
  • Height grid of the part

    Samples the part's top surface on a grid for the first search of the tool-tip height.

    H[i, j] = height at cell center; cell = max(0.02, R ÷ 8)

    3D finishing toolpaths cam-finish.js
    • PartCraft
    32-bit in part
  • Tool-tip height

    The lowest height at which the tool at (x, y) touches the part without cutting into it.

    z = max(H − h(ρ)) over grid samples within R; refine at ρ* = A + r_c s ÷ √(1 + s²) uphill; then max over triangle edges by ternary search; result = max(z + leave, floor)

    3D finishing toolpaths cam-finish.js
    • PartCraft
    32-bit in part
  • Slope filter

    Whether the surface under a point is within the slope range chosen for the operation.

    s = √(g_x² + g_y²); tan(from) − 1e-9 ≤ s ≤ tan(to) + 1e-9

    3D finishing toolpaths cam-finish.js
    • PartCraft
    32-bit in part
  • Finishing one straight line

    The 3D points of a straight pass over the part, dense enough to stay within the tolerance.

    split a span while |z(mid) − (z₀ + z₁) ÷ 2| > tol ÷ 2

    3D finishing toolpaths cam-finish.js
    • PartCraft
    64-bit
  • Thinning a pass

    Drops points that lie on a straight run between their neighbors.

    drop p when its distance to the line through the last kept point and the next point ≤ tol ÷ 10

    3D finishing toolpaths cam-finish.js
    • PartCraft
    64-bit
  • Parallel pass lines

    The positions of the raster lines across the part at the chosen angle.

    n = ceil((v₁ − v₀) ÷ (stepover × d) − 1e-9); line k at v₀ + (v₁ − v₀) k ÷ n

    3D finishing toolpaths cam-finish.js
    • PartCraft
    64-bit
  • Cusp height

    The height of the ridge left between two ball passes a given distance apart on a flat surface.

    h = R − √(R² − (s ÷ 2)²)

    3D finishing toolpaths cam-finish.js
    • PartCraft
    64-bit
  • Pass spacing for a cusp height

    The distance between passes that leaves ridges of a given height.

    s = 2 √(2 R h − h²); s = 2 R when h ≥ R

    3D finishing toolpaths cam-finish.js
    • PartCraft
    64-bit
  • Distance over the surface

    The distance along the part's top surface from the starting cells to every other cell.

    shortest path over grid steps; step length = √((di × c)² + (dj × c)² + ΔH²)

    3D finishing toolpaths cam-finish.js
    • PartCraft
    64-bit
  • Step directions of the distance search

    The set of grid steps the surface-distance search may take.

    all (di, dj) with |di|, |dj| ≤ 5 and no common factor

    3D finishing toolpaths cam-finish.js
    • PartCraft
    Exact
  • Lines of equal surface distance

    Traces the lines at a given surface distance, which become the scallop passes.

    crossing on a cell edge at f = (level − a) ÷ (b − a)

    3D finishing toolpaths cam-finish.js
    • PartCraft
    64-bit
  • Scallop spacing and levels

    The spacing of scallop passes from the cusp height, and the surface distances they are placed at.

    R_b = ball or corner radius + leave; s = spacing(R_b, cusp); level k = (k + ½) s; grid cell = max(0.02, min(s ÷ 3, d ÷ 8))

    3D finishing toolpaths cam-finish.js
    • PartCraft
    64-bit
  • Simplifying a scallop pass

    Reduces the points of a 3D pass while staying within a quarter of the tolerance.

    keep the point farthest from the chord when its distance > tolerance ÷ 4, then repeat on both halves

    3D finishing toolpaths cam-finish.js
    • PartCraft
    64-bit
  • Tool grown by the stock to leave

    Models stock to leave by making the cutter larger.

    d′ = d + 2 × leave; corner radius′ = corner radius + leave (bull nose)

    3D finishing toolpaths cam-finish.js
    • PartCraft
    64-bit
  • Conversion to single precision

    single(A): each value rounded to the nearest 32-bit floating-point number.

    x ← fround(x)

    CraftScript number type conversions cs-lib-core.js
    • PartCraft
    32-bit in part
  • Conversion to whole-number types

    int8, int16, int32, int64 and the unsigned forms: each value rounded to a whole number.

    x ← round(x); NaN → 0

    CraftScript number type conversions cs-lib-core.js
    • PartCraft
    64-bit
  • Section of a faceted mesh

    The section view's visible lines, cut outline, extents and the cutting plane's trace.

    Drawing section view of a faceted part drawing.js
    • PartCraft
    32-bit in part
  • Minimum safety factor

    The yield stress divided by the largest nodal von Mises stress.

    safety = S_y ÷ σ_max

    Voxel stress analysis: 32-bit steps in loads and results fea.js
    • PartCraft
    32-bit in part
  • Values on the plot mesh

    Stress, displacement size and displacement vector at each vertex of the plot mesh, read by the hover probe and the legend.

    Voxel stress analysis: 32-bit steps in loads and results fea.js
    • PartCraft
    32-bit in part
  • Force and pressure on faces

    Shares a force or a pressure over the nodes of the picked faces.

    node force = magnitude × weightᵢ ÷ Σ weight × direction; pressure magnitude = p × area

    Voxel stress analysis: 32-bit steps in loads and results fea.js
    • PartCraft
    32-bit in part
  • The mesh handed to the flow solver

    Builds the job for a flow study from the part and the study's settings.

    Flow study: 32-bit steps in the mesh and the result fields flow-study.js
    • PartCraft
    32-bit in part
  • Cell fields, maximum speed and pressure range

    Velocity and pressure of every cell in physical units, and the largest speed and lowest and highest pressure the results state.

    v = u × c_u; p = p_ref + (ρ − 1) ÷ 3 × c_p; v_max = max |v|

    Flow study: 32-bit steps in the mesh and the result fields flow-worker.js
    • PartCraft
    32-bit in part
  • Pressure on the part's surface

    The static pressure at each vertex of the plot mesh, sampled a little way into the fluid.

    p = Σ (wᵢ + 1e-6) pᵢ ÷ Σ (wᵢ + 1e-6) over the fluid cells around the sample point

    Flow study: 32-bit steps in the mesh and the result fields flow-worker.js
    • PartCraft
    32-bit in part
  • Result probe

    Shows the speed, velocity and pressure of the cell under the pointer, or the surface pressure.

    speed = √(v_x² + v_y² + v_z²)

    Flow study: 32-bit steps in the mesh and the result fields flow-ui.js
    • PartCraft
    32-bit in part
  • Lattice Mach number warning

    The fastest cell's speed as a share of the lattice speed of sound.

    Ma = v_max × dt ÷ dx × √3

    Flow study: 32-bit steps in the mesh and the result fields flow-ui.js
    • PartCraft
    32-bit in part
  • Model constants

    The constants of the turbulence model.

    c_w1 = c_b1 ÷ κ² + (1 + c_b2) ÷ σ

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • Spalding's law of the wall

    y⁺ as a function of u⁺.

    y⁺ = u⁺ + e^(−κB) (e^(κu⁺) − 1 − κu⁺ − (κu⁺)² ÷ 2 − (κu⁺)³ ÷ 6)

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • Friction velocity

    Solves the wall law for the friction velocity from the speed at a distance from the wall.

    find u_τ with spalding(U ÷ u_τ) = y u_τ ÷ ν

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • Inverse wall law

    u⁺ as a function of y⁺.

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • Wall cells: normal and wall distance

    Each wall cell's wall normal and its true distance to the wall, and the model's starting fields.

    n = Σ wᵢ nᵢ ÷ |Σ wᵢ nᵢ|; y = Σ wᵢ c_n (q c_n) ÷ Σ wᵢ c_n over links with c_n > 0.3, y ≥ 0.05

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    32-bit in part
  • Wall distance of every cell

    The distance from each fluid cell to the nearest wall point.

    d(m) = |v(n) − c| carried from a settled neighbor n along the link c

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • Model update in a cell

    The wall function in wall cells and one pseudo-time step of the model equation elsewhere.

    ν̃_new = (ν̃ + Δt × rhs) ÷ (1 + Δt c_w1 f_w ν̃ ÷ d²); wall cell: ν̃ = κ u_τ y

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • Pseudo-time step

    The model's time step from the advection and diffusion limits.

    Δt = max(0.05, min(every, 0.5 ÷ u_max, 0.8 σ ÷ (6 (ν + ν̃_max))))

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • First-cell y⁺ statistics

    The minimum, maximum, mean and percentiles of y⁺ over the wall cells.

    percentile p = sorted[⌊p × n⌋]

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • Wall force correction for slip

    The term added to the momentum-exchange force on walls that carry a slip velocity.

    F += Σ u_w (f_in − f_out)

    Flow study: turbulence model and wall functions flow-turb.js
    • PartCraft
    64-bit
  • Hull mesh taken from the built part

    Copies the part's triangle mesh for the hull calculation.

    Hull hydrostatics and righting arms hydrostatics.js
    • PartCraft
    32-bit in part
  • Volume, moments and waterplane under a waterline

    Clips the mesh at the waterline and sums the wet volume, its first moments, the wetted area and the waterplane's boundary integrals.

    V = Σ a·(b × c) ÷ 6; ∫x dV = ½ ∮ x² nₓ dS; A = ½ Σ (pₓ q_z − qₓ p_z); ∫z² dA = Σ (p_z² + p_z q_z + q_z²)(pₓ q_z − qₓ p_z) ÷ 12

    Hull hydrostatics and righting arms hydrostatics.js
    • PartCraft
    32-bit in part
  • Hydrostatic properties at a draft

    Volume, displacement, KB, LCB, waterplane area and centroid, BM, KM, block and waterplane coefficients, and mass per unit immersion.

    V = V_skin + h × A ÷ 3; I_T = ∫z² dA − A × c_z²; BM = I ÷ V; KM = KB + BM; Δ = V × 1e-9 × ρ

    Hull hydrostatics and righting arms hydrostatics.js
    • PartCraft
    32-bit in part
  • Righting arms at fixed displacement

    The righting arm GZ at each heel angle, the metacentric height GM, the largest GZ and the angle where stability vanishes.

    GZ = z(B) − (keel + KG) × sin θ; GM = KM_T − KG; vanishing angle by linear interpolation between samples

    Hull hydrostatics and righting arms hydrostatics.js
    • PartCraft
    32-bit in part
  • Units and rounding of the answer

    Converts the hull results to meters, square meters, cubic meters and tonnes for the tool's answer.

    value_m = round(value_mm ÷ 1000 × 10⁴) ÷ 10⁴; volume_m³ = round(V ÷ 1e9 × 10⁴) ÷ 10⁴

    Hull hydrostatics and righting arms hydrostatics.js
    • PartCraft
    32-bit in part
  • Coordinate and direction text

    Formats a coordinate or a direction component as a STEP real.

    text = v.toFixed(digits), trailing zeros removed; digits = 6 for points, 12 for directions

    IFC export of parts, assemblies and library items ifc-export.js
    • PartCraft
    64-bit
  • Quantity and property value text

    Formats a volume, area, mass, length or parameter value as a STEP real.

    text = Number(v.toPrecision(12))

    IFC export of parts, assemblies and library items ifc-export.js
    • PartCraft
    64-bit
  • Triangulated body

    Writes the vertices and triangles of the built mesh as an IfcTriangulatedFaceSet.

    (x, y, z) → (x, −z, y), each written with 6 decimals

    IFC export of parts, assemblies and library items ifc-export.js
    • PartCraft
    32-bit in part
  • Volume, area, weight and overall size

    The quantity sets of an element: net volume in m³, net surface area in m², net weight in kg and the box dimensions in mm.

    V_m³ = V_mm³ × 1e-9; A_m² = A_mm² × 1e-6; weight_kg = V_mm³ × density_g/cm³ × 1e-6; size = |max − min|

    IFC export of parts, assemblies and library items ifc-export.js
    • PartCraft
    64-bit
  • Volume and area of a library item's body

    Volume, surface area and bounding box of a library item's mesh for its quantities.

    V = |Σ a·(b × c) ÷ 6|; A = Σ |(b − a) × (c − a)| ÷ 2

    IFC export of parts, assemblies and library items ifc-export.js
    • PartCraft
    64-bit
  • Placement of an assembly instance

    Turns an instance's 4 × 4 matrix into an IFC axis placement: location, local z axis and local x axis.

    location = C(column 3); Axis = C(column 1); RefDirection = C(column 0); C(x, y, z) = (x, −z, y)

    IFC export of parts, assemblies and library items ifc-export.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.