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
-
Arc and circle
A circular arc, or a full circle, as an exact rational quadratic curve.
pieces of at most 90°; Δθ = θ ÷ pieces; middle weight = cos(Δθ ÷ 2); P₁ = P₀ + T₀·r·tan(Δθ ÷ 2)
NURBS curves and surfaces: points, derivatives, normals and curvature nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Polyline as a curve
A degree 1 curve through given points, with knots in proportion to the lengths of its segments.
Lᵢ = Lᵢ₋₁ + max(1e-12, |Pᵢ − Pᵢ₋₁|); knotᵢ = Lᵢ ÷ L(last)
NURBS curves and surfaces: points, derivatives, normals and curvature nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Transforming a curve
Moves a curve by a 4 × 4 matrix.
NURBS curves and surfaces: points, derivatives, normals and curvature nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Point on a surface
The point of a NURBS surface at (u, v).
S(u, v) = Σᵢ Σⱼ Nᵢ(u)·Nⱼ(v)·wᵢⱼ·Pᵢⱼ ÷ Σᵢ Σⱼ Nᵢ(u)·Nⱼ(v)·wᵢⱼ
NURBS curves and surfaces: points, derivatives, normals and curvature nurbs/surface.js64-bit- ModelCraft
- PartCraft
-
Derivatives of a surface
The point and the partial derivatives up to total order d at (u, v).
S⁽ᵏˡ⁾ = (A⁽ᵏˡ⁾ − lower-order terms weighted by binomials and derivatives of w) ÷ w
NURBS curves and surfaces: points, derivatives, normals and curvature nurbs/surface.js64-bit- ModelCraft
- PartCraft
-
Surface normal
The unit normal at (u, v), including at poles and collapsed edges.
n = unit(S_u × S_v)
NURBS curves and surfaces: points, derivatives, normals and curvature nurbs/surface.js64-bit- ModelCraft
- PartCraft
-
Moving off a collapsed edge
Chooses where curvature is evaluated when the point asked for lies on a collapsed edge.
NURBS curves and surfaces: points, derivatives, normals and curvature nurbs/surface.js64-bit- ModelCraft
- PartCraft
-
Surface curvature
Gaussian and mean curvature, the two principal curvatures and their directions.
K = (LN − M²) ÷ (EG − F²); H = (EN − 2FM + GL) ÷ (2(EG − F²)); k₁,₂ = H ± √(H² − K)
NURBS curves and surfaces: points, derivatives, normals and curvature nurbs/surface.js64-bit- ModelCraft
- PartCraft
-
Normal curvature in a direction
The curvature of the surface along a given tangent direction.
a, b from t = a·S_u + b·S_v; κₙ = (L·a² + 2M·ab + N·b²) ÷ (E·a² + 2F·ab + G·b²)
NURBS curves and surfaces: points, derivatives, normals and curvature nurbs/surface.js64-bit- ModelCraft
- PartCraft
-
Iso-curve of a surface
The curve on a surface at a fixed u or v, as an exact NURBS curve.
row j = Σₐ Nₐ(t)·Pwₐⱼ in homogeneous coordinates
NURBS curves and surfaces: points, derivatives, normals and curvature nurbs/surface.js64-bit- ModelCraft
- PartCraft
-
Angle between two vectors
The angle between two vectors, 0 to π.
angle = atan2(|a × b|, a·b)
NURBS curves and surfaces: points, derivatives, normals and curvature nurbs/vec.js64-bit- ModelCraft
- PartCraft
-
Applying a 4 × 4 matrix
A point or a direction multiplied by a row-major affine matrix.
p′ᵢ = mᵢ₀·x + mᵢ₁·y + mᵢ₂·z + mᵢ₃·w
NURBS curves and surfaces: points, derivatives, normals and curvature nurbs/vec.js64-bit- ModelCraft
- PartCraft
-
Curvature maps
Gaussian, mean and largest principal curvature at every vertex of a surface's tessellation, with their ranges.
k_max = max(|H + d|, |H − d|), d = √(max(0, H² − K))
NURBS curves and surfaces: points, derivatives, normals and curvature nurbs/analysis.js64-bit- ModelCraft
- PartCraft
-
Curvature comb
Teeth along a curve whose length shows the curvature, and the largest curvature found.
u = a + (b − a)·i ÷ samples; q = p − scale·κN; max = largest |κN| at the samples
NURBS curves and surfaces: points, derivatives, normals and curvature nurbs/analysis.js64-bit- ModelCraft
- PartCraft
-
Curvature range for the legend
The Gaussian curvature range that the curvature colors and their legend span.
max = largest |K| over all shown surfaces; range = [−max, max]
NURBS curves and surfaces: points, derivatives, normals and curvature nurbs-ui/display.js64-bit- ModelCraft
- PartCraft
-
Knot insertion
Adds a knot to a curve r times without changing its shape.
α = (u − U[L + i]) ÷ (U[i + k + 1] − U[L + i]); Q = α·R[i + 1] + (1 − α)·R[i]
NURBS knot insertion and removal, degree change, split and join nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Tolerance in homogeneous space
Converts a distance tolerance into one for weighted control points.
TOL = tol·w_min ÷ (1 + max |P|)
NURBS knot insertion and removal, degree change, split and join nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Knot removal
Removes copies of an interior knot while the curve moves no more than a tolerance.
candidates: (P[i] − (1 − α)·T[i − 1]) ÷ α and (P[j] − α·T[j + 1]) ÷ (1 − α); removed when they agree within TOL
NURBS knot insertion and removal, degree change, split and join nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Bézier pieces
The curve as one Bézier piece per knot span.
NURBS knot insertion and removal, degree change, split and join nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Degree elevation
Raises the degree of a curve by t.
Qᵢ = Σⱼ C(p, j)·C(t, i − j) ÷ C(p + t, i) · Pⱼ on each Bézier piece
NURBS knot insertion and removal, degree change, split and join nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Degree reduction
Lowers the degree by one if the curve moves no more than a tolerance, and reports a bound on the change.
left and right reduced points blended by λ = i ÷ q; error = largest distance between the re-elevated and the original control points
NURBS knot insertion and removal, degree change, split and join nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Splitting a curve
Cuts a curve in two at a parameter.
NURBS knot insertion and removal, degree change, split and join nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Rescaling the parameter
Maps a curve's knots onto a new interval.
knot′ = a + (knot − c_a)·(b − a) ÷ (c_b − c_a)
NURBS knot insertion and removal, degree change, split and join nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Reversing a curve
The same curve run the other way.
knot′ = a + b − knot, in reverse order
NURBS knot insertion and removal, degree change, split and join nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Joining curves
Makes one curve from curves that meet end to end.
joint point = (end of one + start of the next) ÷ 2 in homogeneous coordinates; knot ranges in proportion to arc length
NURBS knot insertion and removal, degree change, split and join nurbs/curve.js64-bit- ModelCraft
- PartCraft
-
Rows back into a surface
Rebuilds a surface from its rows after a curve operation was applied to each row.
NURBS knot insertion and removal, degree change, split and join nurbs/surface.js64-bit- ModelCraft
- PartCraft
-
Degree elevation of a surface
Raises the degree of a surface in one direction.
NURBS knot insertion and removal, degree change, split and join nurbs/surface.js64-bit- ModelCraft
- PartCraft
-
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
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.