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
-
Rescaling a surface's parameters
Maps the knots of one direction onto a new interval.
knot′ = a + (knot − k_a)·(b − a) ÷ (k_b − k_a)
NURBS knot insertion and removal, degree change, split and join nurbs/surface.js64-bit- ModelCraft
- PartCraft
-
Uniform knots for a curve from control points
The knot vector given to a curve drawn by its control points when none is supplied.
p + 1 zeros; i ÷ (n − p) for i = 1 … n − p − 1; p + 1 ones
NURBS knot insertion and removal, degree change, split and join nurbs/tools.js64-bit- ModelCraft
- PartCraft
-
Parameter from a fraction
The curve parameter for a command's position given as a fraction 0 to 1.
u = a + (b − a)·f
NURBS knot insertion and removal, degree change, split and join nurbs/tools.js64-bit- ModelCraft
- PartCraft
-
Closest point on a curve
The parameter, point and distance of the point of a curve nearest a given point.
f(u) = (C − P)·C′; u ← u − f ÷ (C″·(C − P) + C′·C′)
NURBS lengths, areas, closest points and tessellation nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Length of a curve
The length of a curve, or of a part of it between two parameters.
s = Σ pieces Σ₈ wᵍ·h·|C′(x₀ + h·(1 + xᵍ))|, 4 pieces per knot span
NURBS lengths, areas, closest points and tessellation nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Parameter at a length
The parameter at which the curve has run a given length from its start.
f(u) = length(a … u) − s; u ← u − f ÷ |C′(u)|, or the middle of the bracket
NURBS lengths, areas, closest points and tessellation nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Curve to polyline
Points along a curve such that the curve stays within a tolerance of the chords between them.
a segment is kept when the curve at 1/4, 1/2 and 3/4 of its parameter range lies within tol of the chord; else it is halved
NURBS lengths, areas, closest points and tessellation nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Are two curves the same
Decides whether one curve lies on another within a tolerance.
33 points of a, each within tol of its closest point on b
NURBS lengths, areas, closest points and tessellation nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Area of a surface
The area of an untrimmed surface.
A = Σ cells Σ₅ₓ₅ wₐ·w_b·h_u·h_v·|S_u × S_v|, 2 × 2 pieces per knot-span cell
NURBS lengths, areas, closest points and tessellation nurbs/surface.js64-bit- ModelCraft
- PartCraft
-
Closest point on a surface
The (u, v), point and distance of the point of a surface nearest a given point.
f = (S − P)·S_u, g = (S − P)·S_v; Newton on the 2 × 2 system with J = [S_u·S_u + r·S_uu, S_u·S_v + r·S_uv; ·, S_v·S_v + r·S_vv]
NURBS lengths, areas, closest points and tessellation nurbs/surface.js64-bit- ModelCraft
- PartCraft
-
Tessellation steps per knot span
How many parameter steps each knot span gets so that the grid stays within the tolerance.
n = ceil(h·√(M ÷ (4·tol))), 2 ≤ n ≤ maxPerSpan, M = largest |second derivative| at 5 × 7 sample points
NURBS lengths, areas, closest points and tessellation nurbs/surface.js64-bit- ModelCraft
- PartCraft
-
Surface to triangle grid
A grid of points, normals and parameters on the surface with two triangles per cell.
NURBS lengths, areas, closest points and tessellation nurbs/surface.js64-bit- ModelCraft
- PartCraft
-
Deviation of points from a surface
The largest, mean and root-mean-square distance of a set of points from a surface.
dᵢ = closest-point distance; max; mean = Σ dᵢ ÷ n; rms = √(Σ dᵢ² ÷ n)
NURBS lengths, areas, closest points and tessellation nurbs/analysis.js64-bit- ModelCraft
- PartCraft
-
Merging knot lists
The list of distinct knots, each with its highest multiplicity, over several curves or surfaces.
key = round(u × 10¹²) ÷ 10¹²
Surfaces from curves: extrude, ruled, revolve and loft nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Making curves compatible
Brings curves to one degree and one knot vector on 0…1.
Surfaces from curves: extrude, ruled, revolve and loft nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Extrude
A surface from a curve pulled along a direction.
second row = P·w + dir·w in homogeneous coordinates
Surfaces from curves: extrude, ruled, revolve and loft nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Revolve
A surface from a profile turned about an axis by an angle.
o = axis point + Z·((P − axis point)·Z); r = |P − o|; row = arc(o, X, Z × X, r, 0, angle)·w
Surfaces from curves: extrude, ruled, revolve and loft nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Loft parameters
The v parameter of each section of a loft.
tₖ = mean over control-point columns of the chord-length parameter of section k; t₀ = 0, t(last) = 1
Surfaces from curves: extrude, ruled, revolve and loft nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Loft
A surface that passes through each section curve at its parameter.
Surfaces from curves: extrude, ruled, revolve and loft nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Sum of control nets
The control net a + b − c used by the Gordon and Coons surfaces.
Pᵢⱼ = aᵢⱼ + bᵢⱼ − cᵢⱼ
Surfaces from curves: extrude, ruled, revolve and loft nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Parameters of the points
A parameter between 0 and 1 for each point to fit.
dᵢ = dᵢ₋₁ + |Qᵢ − Qᵢ₋₁| (or its square root, or 1); tᵢ = dᵢ ÷ d(last)
Curves through points nurbs/fit.js64-bit- ModelCraft
- PartCraft
-
Knots by averaging
A clamped knot vector for a given number of control points from the points' parameters.
equal counts: U(j + p) = (t(j) + … + t(j + p − 1)) ÷ p; more points than control points: U = (1 − α)·t(i − 1) + α·t(i), i = floor(j·d), α = j·d − i
Curves through points nurbs/fit.js64-bit- ModelCraft
- PartCraft
-
Interpolating curve
The curve of a given degree through every point.
Σⱼ Nⱼ(tᵢ)·Pⱼ = Qᵢ for every point; Σⱼ N′ⱼ(t)·Pⱼ = D at an end with a given derivative
Curves through points nurbs/fit.js64-bit- ModelCraft
- PartCraft
-
Interpolating many lists at once
Control points for several point lists that share parameters, used for the columns of a loft or a curve network.
Curves through points nurbs/fit.js64-bit- ModelCraft
- PartCraft
-
Linear solve
Solves A·x = B for several right-hand sides.
Gaussian elimination with partial pivoting, then back-substitution
Curves through points nurbs/vec.js64-bit- ModelCraft
- PartCraft
-
Least-squares curve with given knots
The curve with given knots that is closest to a set of points, with its ends on the first and last point.
(NᵀN)·P = NᵀR, R = Q − N₀·Q₀ − Nₙ·Q(last)
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/fit.js64-bit- ModelCraft
- PartCraft
-
Least squares for many lists
The same fit for several point lists that share parameters and knots.
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/fit.js64-bit- ModelCraft
- PartCraft
-
Fitting a curve to a function
A curve within a tolerance of a parametric function, with as few control points as the refinement finds.
deviation = max |C(s) − f(s)| at the midpoints between fitting samples; count ← ceil(1.5·count) + 1 until deviation ≤ tol
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/fit.js64-bit- ModelCraft
- PartCraft
-
Fitting a surface to a function
A surface within a tolerance of a function of (u, v).
deviation = max of three sampled sets (between samples along u, along v, and at cell middles); the direction with the larger error gets ceil(1.5·n) + 1 control points
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/fit.js64-bit- ModelCraft
- PartCraft
-
Rebuilding a curve
A curve with a chosen number of control points and uniform knots that follows the original, with the deviation measured.
samples = max(4·count, 32); deviation = closest-point distance of the points midway between samples
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/fit.js64-bit- ModelCraft
- PartCraft
-
Deviation of points from a curve
The largest and mean distance of a set of points from a curve.
dᵢ = closest-point distance; max; mean = Σ dᵢ ÷ n
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/fit.js64-bit- ModelCraft
- PartCraft
-
Frames along a rail
A frame (origin, tangent and two cross directions) at each requested parameter of a rail, turning as little as possible.
double reflection: r reflected in the chord, then in the difference of tangents; then made square to the tangent
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Placing a profile in a frame
The profile's control points carried from the start frame to another frame, turned and scaled.
(a, b, z) = (d·r₀, d·s₀, d·t₀); (a, b) rotated by the twist; P′ = o + r·a·scale + s·b·scale + t·z·scale
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Sweep refinement
Lofts through placed sections and adds sections until the surface matches the true placement between them.
deviation = max |S(u, v_mid) − section(u)| at 13 points on each middle section; sections doubled until deviation ≤ tol
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Frame between two rails
The frame and the gap between two rails at a parameter, which place and scale the profile of a two-rail sweep.
X = (B − A) ÷ d, d = |B − A|; Z = unit(T₁ + T₂ − X·((T₁ + T₂)·X)); scale = d ÷ d₀
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Where two curves come closest
The parameters on two curves where they are nearest each other, and the distance there.
f = (A − B)·A′, g = −(A − B)·B′; Newton on the 2 × 2 system
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Monotone cubic interpolation
A smooth increasing map between a curve's own crossing parameters and the shared ones of a network.
interior slope = (w₁ + w₂) ÷ (w₁ ÷ δ₁ + w₂ ÷ δ₂), 0 where δ changes sign; cubic Hermite between nodes
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Surface through a network of curves
A Gordon surface through a grid of profile and guide curves.
S = L_u + L_v − T
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Coons patch
A surface filling four boundary curves that meet at their corners.
S = ruled(a, b) + ruled(l, r) − bilinear(corners)
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Offset surface
A surface at a distance from another along its normals.
target(u, v) = S(u, v) + n(u, v)·d, fitted within tol
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Rebuilding a surface
A surface with a chosen number of control points and uniform knots that follows the original, with the deviation measured.
samples = max(4·n, 16) each way; deviation = max |S′ − S| at the cell middles
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Extending a surface
Carries a surface on past an edge by a length measured across the edge at its middle.
the last span's polynomial evaluated by de Casteljau at t = (1 + du − last) ÷ (1 − last) > 1; du by secant steps until |length found − length| ≤ 1e-10·length
Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions nurbs/construct.js64-bit- ModelCraft
- PartCraft
-
Continuity class
Turns the measured gap, angle and curvature difference into G2, G1, G0 or none.
gap ≤ g0 → G0; and angle ≤ g1 → G1; and (dk ≤ g2 or rel ≤ g2rel) → G2
Continuity between curves and between surfaces nurbs/continuity.js64-bit- ModelCraft
- PartCraft
-
Join of two curves
The gap, the angle between tangents and the curvature difference where two curve ends meet.
gap = |P_a − P_b|; angle = atan2(|t_a × t_b|, t_a·t_b)·180 ÷ π; dk = |κN_a − κN_b|; rel = dk ÷ max(κ_a, κ_b)
Continuity between curves and between surfaces nurbs/continuity.js64-bit- ModelCraft
- PartCraft
-
Shared edge of two surfaces
Gap, normal angle and curvature difference at sample points along a shared edge, with the largest of each.
per sample: gap = |p_A − p_B|; angle between n_A and n_B; dk = |κ_A − κ_B| in the direction n_A × edge tangent
Continuity between curves and between surfaces nurbs/continuity.js64-bit- ModelCraft
- PartCraft
-
Values written into a problem
Rounds the measured gap, angle or curvature difference for a problem's found value and its text.
r4(x) = x rounded to 4 significant digits
Continuity between curves and between surfaces nurbs/continuity.js64-bit- ModelCraft
- PartCraft
-
Signed area of a loop
The signed area of a loop in the (u, v) plane; its sign tells which way the loop runs.
a = Σ (uᵢ·vᵢ₊₁ − uᵢ₊₁·vᵢ) ÷ 2
Trimmed surfaces: loops, cut tessellation and area nurbs/trim.js64-bit- ModelCraft
- PartCraft
-
Point inside a loop
Decides whether a (u, v) point is inside a loop.
count edges with (v_a > v) ≠ (v_b > v) and u < (u_b − u_a)·(v − v_a) ÷ (v_b − v_a) + u_a
Trimmed surfaces: loops, cut tessellation and area nurbs/trim.js64-bit- ModelCraft
- PartCraft
-
Do two segments cross
Decides whether two loop segments properly cross.
t, u = cross products ÷ d; crossing when 1e-12 < t < 1 − 1e-12 and 1e-12 < u < 1 − 1e-12
Trimmed surfaces: loops, cut tessellation and area nurbs/trim.js64-bit- ModelCraft
- 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.