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
-
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
-
Number formatter
Writes one number as macro text.
text = toPrecision(v, 15); |v| < 1e-14 → 0
Numbers written into the VBA macro export swmacro.js64-bit- PartCraft
-
Millimeters to meters
Converts a length or a coordinate from millimeters to the meters the macro uses.
m = round(mm × 10⁶) ÷ 10⁹
Numbers written into the VBA macro export swmacro.js64-bit- PartCraft
-
Degrees to radians
Converts an angle in degrees to the radians the macro uses.
rad = deg × π ÷ 180
Numbers written into the VBA macro export swmacro.js64-bit- PartCraft
-
Unit-vector component
Writes a component of a sketch plane's normal or x direction.
u = round(v × 10¹²) ÷ 10¹²
Numbers written into the VBA macro export swmacro.js64-bit- PartCraft
-
Sketch dimension value and text position
Works out the value of each sketch dimension in meters or radians and where its text sits.
length: value ÷ 1000; angle: value × π ÷ 180; arc radius = |start − center|
Numbers written into the VBA macro export swmacro.js64-bit- PartCraft
-
Pick point on a face
Finds a point inside a face, used by the macro to select that face.
centroid of the largest triangle = (a + b + c) ÷ 3, moved onto the plane: p − ((p − o)·n) n
Numbers written into the VBA macro export swmacro.js64-bit- PartCraft
-
Countersink depth and taper
The depth and half angle of the tapered cut that stands in for a countersink.
depth = (D − d) ÷ 2 ÷ tan(angle × π ÷ 360); taper = angle ÷ 2 × π ÷ 180
Numbers written into the VBA macro export swmacro.js64-bit- PartCraft
-
Expected volume and box after each step
Writes the part's volume and bounding box after a feature, for the macro to compare with what it built.
volume in m³ = volume in mm³ × 10⁻⁹; box corners through the millimeter-to-meter conversion
Numbers written into the VBA macro export swmacro.js64-bit- PartCraft
-
Body check tolerances in the macro
The comparison the macro makes between the body it built and the expected volume and box.
|v − vol| ≤ 10⁻⁴ × |vol| + 10⁻¹⁵; |box − expected| ≤ 10⁻⁵ m + 0.02 × diagonal
Numbers written into the VBA macro export swmacro.js64-bit- PartCraft
-
Final volume comparison
Writes the finished part's volume into the macro and the test that reports whether the rebuilt part matches.
|v − vol| ≤ 10⁻⁴ × vol, v = reported volume × 10⁹ (mm³)
Numbers written into the VBA macro export swmacro.js64-bit- PartCraft
-
Numbers in equations
Writes a parameter expression as equation text for the macro, including its numeric constants.
constant → formatNumber(value); pow(a, b) → (a) ^ (b); log(x) → log(x) ÷ log(10)
Numbers written into the VBA macro export swmacro.js64-bit- PartCraft
-
64-point rule on the tetrahedron
Builds the integration points and weights used for mass and body loads.
x = u, y = v(1 − u), z = w(1 − u)(1 − v); weight = wₐ w_b w_c ÷ 8 × (1 − u)² (1 − v)
Quadratic tetrahedron element matrices tetfea.js64-bit- PartCraft
-
Shape functions of the 10-node tetrahedron
The ten shape functions and their derivatives at a point of the element.
corner: N = L(2L − 1); midside: N = 4 LᵢLⱼ
Quadratic tetrahedron element matrices tetfea.js64-bit- PartCraft
-
Jacobian and physical derivatives
The element's Jacobian determinant at a point and the shape-function derivatives in x, y and z.
J = Σ xₐ ∂Nₐ/∂ξ; det J by cofactors; ∂N/∂x = J⁻ᵀ ∂N/∂ξ
Quadratic tetrahedron element matrices tetfea.js64-bit- PartCraft
-
Element stiffness
The 30 × 30 stiffness matrix of one element and its volume.
Kₑ = Σₚ wₚ det Jₚ E · Bᵀ D B; volume = Σₚ wₚ det Jₚ
Quadratic tetrahedron element matrices tetfea.js64-bit- PartCraft
-
Element mass and shape-function integrals
The consistent mass matrix of one element and ∫N dV for each node, used for gravity.
Mₑ = Σₚ ρ wₚ det Jₚ NₐN_b; ∫Nₐ dV = Σₚ wₚ det Jₚ Nₐ
Quadratic tetrahedron element matrices tetfea.js64-bit- PartCraft
-
Stress and strain at a Gauss point
The six strains and six stresses at one Gauss point from the element's displacements.
ε = B u; σ = E · D (ε − α ΔT [1 1 1 0 0 0])
Quadratic tetrahedron element matrices tetfea.js64-bit- PartCraft
-
6-point rule on a triangle face
The points and weights used to integrate loads, areas and heat exchange over boundary faces.
Quadratic tetrahedron element matrices tetfea.js64-bit- PartCraft
-
Shape functions of the 6-node face
The six shape functions of a boundary face and their derivatives.
corner: N = L(2L − 1); midside: N = 4 LᵢLⱼ
Quadratic tetrahedron element matrices tetfea.js64-bit- PartCraft
-
Integration over a boundary face
The area-weighted normal and position at each rule point of a curved boundary face.
n dA = (∂x/∂L₁ × ∂x/∂L₂) × w ÷ 2
Quadratic tetrahedron element matrices tetfea.js64-bit- PartCraft
-
Area element on a face for heat terms
The area weight at each rule point of a 6-node face, for heat exchange and heat loads.
dA = |∂x/∂L₁ × ∂x/∂L₂| × w ÷ 2
Quadratic tetrahedron element matrices tet-elements.js64-bit- PartCraft
-
Element conductivity matrix
The 10 × 10 heat conduction matrix of one element.
Kₑ = Σₚ wₚ det Jₚ k ∇Nₐ·∇N_b
Quadratic tetrahedron element matrices tet-elements.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.