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
-
Ellipse as line pieces
The line pieces an ellipse is drawn and plotted with.
Wide polylines, text masks and ellipses as drawn and plotted walk.js64-bit- CadCraft
-
Linetype scale of an object
The factor that sizes the dashes of an object's linetype.
scale = LTSCALE × object scale × plot style table scale (non-ISO linetypes only)
Wide polylines, text masks and ellipses as drawn and plotted walk.js64-bit- CadCraft
-
Meters to drawing units
A 3D point in meters as a point in drawing units.
x = pₓ ÷ k; y = pᵧ ÷ k; z = p_z ÷ k
Points and heights picked in the 3D view ws3d-core.js64-bit- CadCraft
-
Point on a level plane
Where the ray under the pointer meets the plane at height z.
plane: n = (0, 0, 1), d = z × k; point = ray hit ÷ k
Points and heights picked in the 3D view ws3d-core.js64-bit- CadCraft
-
Height following the cursor
A height above a base outline, taken from where the pointer's ray passes nearest the vertical line through the outline's middle.
c = Σ ring points ÷ n; height = s ÷ k, with s the distance along the vertical line from (cₓ·k, cᵧ·k, z₀·k)
Points and heights picked in the 3D view ws3d-core.js64-bit- CadCraft
-
2D drawing as snap edges
The visible lines and arcs of the 2D drawing as edges on the ground, in meters, for the 3D snaps.
edge = (x·k, y·k, 0); arc: m = max(2, ⌈sweep ÷ 7.5°⌉) chords
Points and heights picked in the 3D view ws3d-core.js64-bit- CadCraft
-
Height shown beside the cursor
The text of the height tip while a height is being picked.
|n| < 1e-9 → 0; else n to 4 decimals, trailing zeros removed
Points and heights picked in the 3D view ws3d-core.js64-bit- CadCraft
-
Unit vector
A direction scaled to length 1, or nothing when it has no length.
l = √(x² + y² + z²); l > 1e-300 → (x, y, z) ÷ l
ACIS solids turned into triangles acis/geom.js64-bit- CadCraft
- ModelCraft
-
Plane
A point of a plane from its (u, v), and back.
P = O + U·u + V·v; u = (p − O)·U; v = (p − O)·V
ACIS solids turned into triangles acis/geom.js64-bit- CadCraft
- ModelCraft
-
Cone and cylinder
A point of a cone or cylinder (circular or elliptical base) from its angle and its height along the axis, and back.
t = ± sin ÷ cos; q = 1 + h·t ÷ R; P = C + X·R·q·cos u + Y·R_m·q·sin u + N·h; u = atan2((d·Y) ÷ R_m, (d·X) ÷ R); apex at h = −R ÷ t
ACIS solids turned into triangles acis/geom.js64-bit- CadCraft
- ModelCraft
-
Sphere
A point of a sphere from longitude and latitude, and back.
P = C + r·cos v·(X·cos u + Y·sin u) + Z·r·sin v; u = atan2(y, x); v = atan2(z, √(x² + y²))
ACIS solids turned into triangles acis/geom.js64-bit- CadCraft
- ModelCraft
-
Torus
A point of a torus from its two angles, and back.
w = A + B·cos v; P = C + X·w·cos u + Y·w·sin u + N·B·sin v; u = atan2(y, x); v = atan2(z, √(x² + y²) − A)
ACIS solids turned into triangles acis/geom.js64-bit- CadCraft
- ModelCraft
-
Spline surface and its inverse
A point of a B-spline surface from (u, v), its normal, and the (u, v) nearest to a given point.
first guess: nearest of 25 × 25 samples; then Gauss–Newton on |p − S(u, v)|² with partial derivatives by central differences of 1e-6 of the range
ACIS solids turned into triangles acis/geom.js64-bit- CadCraft
- ModelCraft
-
Knot span
Which knot interval a parameter falls in.
ACIS solids turned into triangles acis/geom.js64-bit- CadCraft
- ModelCraft
-
De Boor evaluation
A point of a B-spline at a parameter, in homogeneous coordinates.
a = (t − Uᵢ) ÷ (Uᵢ₊ₚ₋ᵣ₊₁ − Uᵢ); d_j = (1 − a)·d_j₋₁ + a·d_j
ACIS solids turned into triangles acis/geom.js64-bit- CadCraft
- ModelCraft
-
Spline curve point
A point of a rational B-spline curve.
P = (X, Y, Z) ÷ W from de Boor
ACIS solids turned into triangles acis/geom.js64-bit- CadCraft
- ModelCraft
-
Spline surface point
A point of a rational B-spline surface.
de Boor along v on each of the p + 1 rows, then de Boor along u on the results
ACIS solids turned into triangles acis/geom.js64-bit- CadCraft
- ModelCraft
-
Model size and tolerances
The size of the whole solid and the tolerances every later test uses.
size = max(|hi − lo|, 2·rad, 1e-9); tol = max(10 × resabs, 1e-5 × size); weld = 1e-9 × size
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Circular and elliptical edges
The points along an edge that is part of a circle or an ellipse.
step = min(7.5°, 2·acos(1 − min(1, 0.0002·size ÷ R))); n = min(4096, ⌈|t₁ − t₀| ÷ max(step, 0.001)⌉)
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Spline edges
The points along an edge that follows a B-spline curve.
N = min(4000, max(64, 24 × spans)) samples; end parameters by nearest sample, then 60 steps of a three-way search; n = ⌈|t₁ − t₀| ÷ (b − a) × N ÷ 4⌉ pieces, 2 to 4096
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Merging vertices
Gives points that coincide one shared vertex, so a closed solid stays closed.
key = round(x ÷ weld), round(y ÷ weld), round(z ÷ weld)
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Does the surface fit its edges
Checks that every edge point of a face lies on the face's surface before the face is used.
|S(inv(p)) − p| ≤ tol for every loop point
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Which way the triangles face
Turns a face's triangles so they point the way the face's outward normal does.
n = (t₁ − t₀) × (t₂ − t₀); vote by the sign of n · normal at the triangle's center
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Flat faces
Triangles of a flat face with its holes.
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Outer loops and holes
Sorts the loops of a face into outlines and the holes inside them.
A = |Σ (uᵢ·vᵢ₊₁ − uᵢ₊₁·vᵢ)| ÷ 2; depth = number of larger loops that contain the middle of the loop's first edge
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Loop unwound on a curved surface
The (u, v) of a loop's points with the angles unwound along the loop, and how many times it goes round the surface.
du wrapped to ±half a turn and added up; windings = round(total ÷ period); pole when cos v · r ≤ tol (sphere) or the cone radius ≤ tol
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Step sizes on a curved face
How finely a curved face is divided.
angles: 7.5°; spline: range ÷ 16 each way; along a cone's axis: max(3 × 7.5° in radians × R, 1e-12)
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Extra points inside a curved face
The points added inside a curved face so that its triangles follow the surface.
one point per grid cell at (i + 0.5 + 0.3·jitter)·cell; kept when inside the face and at least 0.35 × the smaller cell side from every boundary edge
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Fixed offset of a grid point
A repeatable offset between −0.5 and 0.5 for each grid cell.
s = sin(12.9898·i + 78.233·j) × 43758.5453; s − ⌊s⌋ − 0.5
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Distance from a point to a segment
How far an inside point is from a boundary edge, in scaled (u, v).
t = clamp(((q − s₀)·d) ÷ |d|², 0, 1); distance = |q − s₀ − t·d|
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Body transform
Moves the mesh by the transform stored with the body.
p′ = s·(p · M) + t; mirrored when det(M)·s³ < 0
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Is the mesh closed
Decides whether the mesh is a closed solid: every edge used once in each direction.
key(a, b) = a × 2³² + b
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
Volume and surface area of the mesh
The volume enclosed by the triangles and their total area.
V = Σ p · (q × r) ÷ 6; A = Σ |(q − p) × (r − p)| ÷ 2
ACIS solids turned into triangles acis/tess.js64-bit- CadCraft
- ModelCraft
-
One span of the curve
The 16 points of the curve between two neighboring outline points.
tᵢ₊₁ = tᵢ + max(√|pᵢ₊₁ − pᵢ|, 1e-9); point = three levels of linear interpolation between p₀ … p₃ at t
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Sampled path of one edge
The points of one seam edge from corner to corner.
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Length of a path
The length of a sampled edge or outline.
L = Σ |pᵢ − pᵢ₋₁|
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Running length
The distance from the start of a path to each of its points.
cᵢ = cᵢ₋₁ + |pᵢ − pᵢ₋₁|
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Point at a distance along a path
The point and direction at a given distance along a path (used to place notches).
k = (d − cᵢ₋₁) ÷ (cᵢ − cᵢ₋₁); point = a + (b − a)·k; tangent = (b − a) ÷ |b − a|
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Nearest point of a path
The point of a path nearest to a given point, and its distance along the path.
k = clamp(((p − a)·v) ÷ |v|², 0, 1); q = a + v·k
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Area of an outline
The signed area inside a closed sampled outline.
A = Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ) ÷ 2
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Centroid of an outline
The middle of area of a closed outline (where the label goes by default).
kᵢ = xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ; a = Σ kᵢ; c = Σ (pᵢ + pᵢ₊₁)·kᵢ ÷ (3·a)
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Where two lines meet
The meeting point of two lines and where it lies along each.
den = r × s; u = ((c − a) × s) ÷ den; point = a + r·u
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Outline direction
Makes an outline run counter-clockwise.
Pattern outlines: curves, lengths and areas addons/apparel/lib/curve.js64-bit- CadCraft
-
Offset of one edge
One edge of the sew line moved outward by its allowance.
n = (tᵧ, −tₓ); moved point = p + n·w; join = meeting point of the two moved lines when |t₁ × t₂| > 1e-9 and it is within 4·w of the vertex
Seam allowance: the cut line addons/apparel/lib/seam.js64-bit- CadCraft
-
Offset of an outline with no corners
A closed smooth outline moved outward by one allowance all round.
vertex = meeting point of the two moved lines; fallback = b + right((t₁ + t₂) ÷ 2)·w
Seam allowance: the cut line addons/apparel/lib/seam.js64-bit- CadCraft
-
Dropping repeated points
Removes points that repeat the one before.
kept when |p − previous| > 1e-9
Seam allowance: the cut line addons/apparel/lib/seam.js64-bit- CadCraft
-
Dropping points on a straight line
Removes cut line points that lie on the straight line between their neighbors.
kept when |u × v| > 1e-9 × |u| × |v|
Seam allowance: the cut line addons/apparel/lib/seam.js64-bit- CadCraft
-
Inside corner
Trims two cut lines where they cross at an inside corner.
Seam allowance: the cut line addons/apparel/lib/seam.js64-bit- CadCraft
-
Corner between two allowances
The points that join the cut lines of two edges at a corner, by the corner's rule.
turn = tₐ × t_b; turn < −1e-9 → inside corner; meeting points used only within 20 × the wider allowance of the corner
Seam allowance: the cut line addons/apparel/lib/seam.js64-bit- CadCraft
-
The whole cut line
The closed cut line of a piece from its sew line and allowances.
Seam allowance: the cut line addons/apparel/lib/seam.js64-bit- CadCraft
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.