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.
Calculations
-
Point snapped onto a curve
The nearest point on a line, circle, arc or spline to the pointer, used when a new point snaps onto a curve.
line: a + t·d, t = ((p − a) · d) ÷ (d · d); circle: c + (p − c) × r ÷ |p − c|
Sketch editor: typed sizes and dimension values sketchview.js64-bit- PartCraft
-
Sketch coordinates to canvas pixels
Maps a sketch point to its place on the canvas.
x = w ÷ 2 + (u − c_x) × s; y = h ÷ 2 − (v − c_y) × s
Sketch editor drawing sketchview.js32-bit, display only- PartCraft
-
Dimension lines and label
The lines, arcs, arrowheads and text of a dimension as drawn.
label text = fmt(value, 3)
Sketch editor drawing sketchview.js32-bit, display only- PartCraft
-
Normal distribution tail
The probability that a standard normal value exceeds z, used for the share of assemblies outside a limit.
P(Z > z) = ½ × erfc(z ÷ √2); erfc(x) ≈ k × exp(−x² − 1.26551223 + k·(1.00002368 + …)), k = 1 ÷ (1 + ½|x|)
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Stack-up analysis
The gap's nominal and mean, its worst-case and statistical limits, each link's share and rank, and the check against the limits.
a = sign × sens; m = nominal + (up + lo) ÷ 2; t = (up − lo) ÷ 2; WC = Σ|a|·t; RSS = √Σ(a·t)²; σ = RSS ÷ 3; ppm = (P_below + P_above) × 10⁶
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Links from picked points
Makes the links of a chain from points picked in order, measured along one direction.
Δs = d · b − d · a; nominal = round(|Δs|, 9 decimals); sign = sign of Δs
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Rounding of measured nominals
Rounds a measured length or direction component before it is stored on a link.
round(v) = Math.round(v × 10⁹) ÷ 10⁹
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Vector stack projected on a direction
Turns a chain whose links run in different directions into a one-direction chain along an output direction, with each link's angular swing as an extra link.
sens = (u · d) × sens; swing: c = nominal × ((axis × u) · d); up, lo = c × angle° × π ÷ 180
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Vector stack analysis
The nominal gap as a vector and its length, and the analysis along each output direction and along the gap itself.
gap = Σ sign × nominal × u; |gap| = √(g_x² + g_y² + g_z²)
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Links from picked points in 3-D
Makes links that run straight from each picked point to the next.
nominal = round(|b − a|, 9 decimals); dir = round((b − a) ÷ |b − a|, 9 decimals)
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Tolerance from a feature control frame
How a geometric tolerance enters a stack: plus and minus half the tolerance zone.
up = tol ÷ 2; lo = −tol ÷ 2
Tolerance stack-ups stackup.js64-bit- PartCraft
-
General tolerance for a nominal size
The deviation a title block's general tolerance gives one nominal size: a class of ISO 2768-1, or a typed ± value.
class f, m, c or v: the table row for the first range with nominal ≤ upper end (0.5 to 4000 mm); typed: parseFloat of the number after ±
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Stack-up as CSV
Writes the links and the results of a stack-up to a CSV file.
every number written as +v.toFixed(4)
Tolerance stack-ups stackup.js64-bit- PartCraft
-
Sizes of a template
One row of parameter values (mm) per size of a standard part family.
value = Number(value.toFixed(4))
Standard part templates stdparts.js64-bit- PartCraft
-
Hexagon across flats
Draws a hexagon from its across-flats size and holds that size with a dimension.
e = s × 2 ÷ √3; first corner at (e ÷ 2, 0)
Standard part templates stdparts.js64-bit- PartCraft
-
Circle of a given diameter
Draws a circle about the origin and holds its diameter with a dimension.
r = d ÷ 2
Standard part templates stdparts.js64-bit- PartCraft
-
Parallel key outline
The round-ended outline of a parallel key from its width and length.
half = (l − b) ÷ 2; center distance = l − b; end radius = b ÷ 2
Standard part templates stdparts.js64-bit- PartCraft
-
Patch through boundary edges
A surface that fills a closed loop of edges, optionally tangent to the faces next to it.
MakeFilling(3, 15, 2, false, 1e-5, 1e-4, 0.01, 0.1, 8, 9)
Surface features built with the kernel surface.js64-bit- PartCraft
-
Loft through wires
A surface or solid through a series of curves in order.
ThruSections(solid, ruled, 1e-6)
Surface features built with the kernel surface.js64-bit- PartCraft
-
Thickening a surface
Turns a surface body into a solid of a given thickness on one side or half on each side.
both sides: offset the sheet by −t ÷ 2, then thicken by t; in: thicken by −t
Surface features built with the kernel surface.js64-bit- PartCraft
-
Offsetting a surface
A new surface at a distance along the normals of an existing one.
MakeOffsetShape.PerformBySimple(sheet, d)
Surface features built with the kernel surface.js64-bit- PartCraft
-
Stitching surfaces
Sews surface bodies together along their edges, into a solid when they close.
edges closer than tol are joined; tol = 0.01 by default
Surface features built with the kernel surface.js64-bit- PartCraft
-
Sketch curves as kernel edges
Turns the lines, arcs, circles and splines of a sketch into the kernel's edges for a loft.
arc: start, middle and end points c + r × (cos, sin) at a₀, a₀ + sweep ÷ 2, a₀ + sweep, then an arc through the three points
Surface features built with the kernel surface.js64-bit- PartCraft
-
Network surface as a kernel face
Hands the surface fitted through a network of curves to the kernel and sets the tolerance its seams are sewn with.
face tolerance 1e-9; sewing tolerance = max(1e-7, 1e-7 × size)
Surface features built with the kernel surface.js64-bit- PartCraft
-
Area of a surface body
The area of each surface body left after a rebuild.
area = Σ over the faces of OpenCascade's surface area
Surface features built with the kernel surface.js64-bit- PartCraft
-
Display mesh of a surface body
The triangles used to draw each surface body.
linear deflection = 2e-4 × diagonal; angular deflection = 2π ÷ 64
Surface display meshes, curvature map and zebra stripes surface.js32-bit, display only- PartCraft
-
Curvature per vertex
The discrete Gaussian and mean curvature at each vertex of a triangle mesh, for the curvature map.
K = (2π − Σ angles) ÷ A; H = |Σ (cot α + cot β)(pᵢ − pⱼ)| ÷ 4A, A = one third of the area of the triangles at the vertex
Surface display meshes, curvature map and zebra stripes surface.js32-bit, display only- PartCraft
-
Zebra stripe value
Whether a surface normal reflects a light or a dark stripe.
r = d − 2(d · n)·n; stripe = ⌊(atan2(r_x, r_z) ÷ π + 1) × stripes ÷ 2⌋ mod 2
Surface display meshes, curvature map and zebra stripes surface.js32-bit, display only- PartCraft
-
Basis functions and derivatives
The B-spline basis functions and their derivatives at a parameter.
Exact surfaces for the tetrahedral mesher surfaces.js64-bit- PartCraft
-
Point and derivatives of a NURBS curve
A rational curve's point and first two derivatives at a parameter.
C = A ÷ w; C′ = (A′ − w′·C) ÷ w; C″ = (A″ − 2w′·C′ − w″·C) ÷ w
Exact surfaces for the tetrahedral mesher surfaces.js64-bit- PartCraft
-
Point and derivatives of a line, circle or ellipse
A profile curve's point and first two derivatives at a parameter.
circle and ellipse: C = c + a·cos t·x + b·sin t·y
Exact surfaces for the tetrahedral mesher surfaces.js64-bit- PartCraft
-
Point and derivatives of a B-spline surface
A B-spline surface's point and all derivatives up to second order at (u, v).
homogeneous sums A[k][l] = Σ Nᵤ⁽ᵏ⁾·Nᵥ⁽ˡ⁾·w·P; S[k][l] by the quotient rule with binomial factors 1, 2, 1
Exact surfaces for the tetrahedral mesher surfaces.js64-bit- PartCraft
-
Closest point on a sphere, torus or cone
The nearest point, the normal there and the distance, in closed form.
sphere: c + r·n̂, d = | |p − c| − r |; torus: tube center m = c + R·ê, then m + r·n̂; cone: τ = ((ρ − r₀)·k + t) ÷ (1 + k²)
Exact surfaces for the tetrahedral mesher surfaces.js64-bit- PartCraft
-
One-dimensional Newton minimizer
Refines the parameter of the nearest point on a profile curve.
Δt = −f′ ÷ f″ (or one sample spacing downhill when f″ ≤ 0); stop when |Δt| ≤ 1e-15 × (|b − a| + |t|)
Exact surfaces for the tetrahedral mesher surfaces.js64-bit- PartCraft
-
Start points for the minimizer
Samples the distance along a curve and runs Newton from the two best samples.
Exact surfaces for the tetrahedral mesher surfaces.js64-bit- PartCraft
-
Closest point on a surface of revolution
The nearest point on a profile turned about an axis.
minimize ½((ρ(v) − ρ_p)² + (t(v) − t_p)²) over the profile parameter v
Exact surfaces for the tetrahedral mesher surfaces.js64-bit- PartCraft
-
Closest point on an extruded surface
The nearest point on a curve swept along a direction.
minimize ½ |across(p − C(u))|²; P = C(u) + ((p − C(u)) · d)·d
Exact surfaces for the tetrahedral mesher surfaces.js64-bit- PartCraft
-
Closest point on a B-spline surface
The nearest point on a B-spline face, kept inside the face's parameter box.
Newton on ∇½|S(u, v) − p|² = 0 with the Hessian [Sᵤ·Sᵤ + Sᵤᵤ·r, Sᵤ·Sᵥ + Sᵤᵥ·r; …]
Exact surfaces for the tetrahedral mesher surfaces.js64-bit- PartCraft
-
Smallest radius of curvature near a point
The radius of curvature the mesher uses to size elements on a curved face.
sphere, torus: r; cone: ρ × √(1 + k²); else 1 ÷ max |Δn| ÷ moved over three directions 60° apart
Exact surfaces for the tetrahedral mesher surfaces.js64-bit- PartCraft
-
Sketch plane from the file
Reads a sketch plane's origin, normal and x direction and checks that x lies in the plane.
|x̂ · n̂| ≤ 1e-6
Import of a parametric export file swimport.js64-bit- PartCraft
-
Sketch points into the part's plane
Builds the file's sketch frame and maps each sketch point into the frame of the plane the sketch is put on.
x = unit(x − n·(x · n)); y = n × x; (u, v) → world = o + u·x + v·y → plane = ((w − o′) · x′, (w − o′) · y′)
Import of a parametric export file swimport.js64-bit- PartCraft
-
Distance from a point to a segment
The distance from a position to a straight piece of an edge.
t = clamp((p − a) · (b − a) ÷ |b − a|², 0, 1); d = |p − (a + t·(b − a))|
Import of a parametric export file swimport.js64-bit- PartCraft
-
Nearest edge to a stored position
Finds which edge of the part built so far a fillet or chamfer in the file refers to, and how far the stored position is from it.
minimum over the edge polyline segments of the point-to-segment distance
Import of a parametric export file swimport.js32-bit in part- PartCraft
-
Distance from a point to a triangle
The distance from a position to one display triangle of a face.
inside the triangle: |(p − a) · n̂|; else the least distance to its three sides
Import of a parametric export file swimport.js64-bit- PartCraft
-
Nearest face to a stored position
Finds which face of the part built so far a feature in the file refers to.
minimum over the display triangles of the point-to-triangle distance
Import of a parametric export file swimport.js32-bit in part- PartCraft
-
Flat face lying in a sketch's plane
Looks for a named flat face of the part in the plane a sketch was drawn on, so the sketch can follow that face.
| |n_face · n| − 1 | < 1e-9 and |(o − o_face) · n_face| < 1e-7 × max(1, |o|)
Import of a parametric export file swimport.js64-bit- PartCraft
-
Base plane and world axis tests
Decides whether a plane is one of the three base planes.
| |n̂ · n_base| − 1 | < 1e-9 and |o · n_base| < 1e-9 × max(1, |o|)
Import of a parametric export file swimport.js64-bit- PartCraft
-
Dimension turned into a parameter
Gives a dimension that other equations use a parameter of its own, holding its value.
expression text = formatNumber(value) (12 significant digits, expr.js)
Import of a parametric export file swimport.js64-bit- PartCraft
-
Equation result against the stored value
Warns when an imported equation would give a different number from the value the file holds.
|v − held| > 1e-6 × max(1, |held|)
Import of a parametric export file swimport.js64-bit- PartCraft
-
Volume check
Compares the volume of the rebuilt part with the volume recorded in the file.
same when |V − V_file| ≤ 1e-4 × max(1, V_file)
Import of a parametric export file swimport.js64-bit- PartCraft
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.