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
-
Surface area and volume of a shape
Whether a group or component is closed, its total face area and, when closed, its volume.
V = Σ a · (b × c) ÷ 6 over all triangles; A = Σ face areas
Face planes, areas, triangles and solid volume m3d/model.js64-bit- CadCraft
- ModelCraft
-
Vertex at a point
The vertex a drawn point becomes: an existing one, or a new one that splits the edge it lands on.
s = (p − A) · u ÷ (u · u); on the edge when 0 < s < 1 and |A + s·u − p| ≤ EPS
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Stops along a new edge
Where a new edge is cut by the vertices and edges it meets.
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Crossing of two edges
The point where two edges cross inside both of them.
n = u × w; s = ((C − A) × w) · n ÷ (n · n); t = ((C − A) × u) · n ÷ (n · n)
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Planes a new edge may close a face on
The planes tried when a new edge might complete a face.
n = u × (C − A), kept when |n| > 1e-9 × |u| × |C − A|
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Faces of a plane from its edges
Which closed loops of edges on a plane are faces, which are holes, and which side each face shows.
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Loops of the planar edge graph
The closed loops formed by the edges on a plane, and the signed area of each.
edges round a vertex sorted by atan2(Δy, Δx); area = ½ Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Point inside a loop
Whether a 2D point is inside a loop, used to match holes and old faces.
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Test point inside a region
A point well inside a region, used to ask which old faces cover it.
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Welding coincident vertices
Merges vertices at the same place and removes edges and loops that collapse.
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Removing a vertex on a straight run
Joins two edges that continue each other in a straight line into one.
merged when u₁ · u₂ ≤ −1 + 1e-9
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Merging coplanar faces
Removes an edge between two faces that lie in one plane and face the same way.
n₁ · n₂ ≥ 1 − 1e-9 and |d₁ − d₂| ≤ EPS
Drawing an edge: welding, splitting and re-facing m3d/model.js64-bit- CadCraft
- ModelCraft
-
Push or pull a face
Moves a face along its normal by a typed or dragged distance, or extrudes it into side faces.
p′ = p + n × distance
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Depth to the face behind
How far a face can be pushed in before it meets the first face behind it.
smallest ray parameter t > EPS along −n
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Moving vertices by a matrix
The new place of each selected vertex under a move, rotate, scale or flip.
p′ = M · p
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Is a face still flat
Whether every corner of a face lies in the face's plane after an edit.
|n · p − d| ≤ 10 × EPS for every corner
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Stretch to a new size
Moves every vertex beyond a cut plane by a distance, as used by typed dimensions and sizes.
p′ = p + d × δ for every vertex with p · d ≥ cut − 10 × EPS
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Profile ring at a path corner
Where each corner of a swept profile lands on the next miter plane of the path.
q′ = q + d × (n · (o − q)) ÷ (n · d)
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Where a line crosses a face
The stretches of a line that lie inside a face, holes left out.
c = P + (Q − P) × s_P ÷ (s_P − s_Q); t = (c − x₀) · u
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Line where two faces cross
The line shared by the planes of two faces, clipped to both.
dir = n_a × n_b; x₀ = ((n_b·d_a − n_a·d_b) × dir) ÷ |dir|²
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Mirror matrix
The matrix that flips geometry through a plane.
M = T(c) · (I − 2·n·nᵀ) · T(−c)
Push/pull, move, stretch, follow me and intersect m3d/model.js64-bit- CadCraft
- ModelCraft
-
Corners of a circle or polygon
The corner points of a circle or regular polygon with a given number of sides.
pᵢ = c + u·r·cos aᵢ + v·r·sin aᵢ, aᵢ = (i ÷ sides) × 2π
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
Corners of an arc
The corner points of an arc from its center, radius, sweep and segment count.
pᵢ = c + u·r·cos aᵢ + v·r·sin aᵢ, aᵢ = sweep × i ÷ segs
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
What a curve is
The length, radius, center, normal and sweep reported for an arc, circle, polygon or smooth curve.
length = Σ |segment|; center = circle through three corners; sweep = |Σ atan2((u₁ × u₂) · n, u₁ · u₂)|
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
Give a curve a new radius
Moves the corners of an arc, circle or polygon to a typed radius about its center.
p′ = c + (p − c) × r ÷ r_old
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
Equal division points
Where the parts of an edge or curve divided into n equal parts meet.
straight edge: a + (b − a) × (i + 1) ÷ n; arc: new corners at equal angles; other curve: equal lengths along its segments
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
Dividing an edge or curve
Adds the corners that divide an edge or curve into n equal parts.
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
Points of a smooth curve
The points of the smooth curve drawn through clicked points.
centripetal Catmull–Rom: knot step = √|pᵢ₊₁ − pᵢ|, evaluated at k ÷ segs of each span
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
Offset of a 2D outline
The corners of an outline moved sideways by a distance.
each segment line moved d along its left unit normal; corner = intersection of neighboring lines
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
Do two outline segments cross
The test that refuses an offset whose loops cross themselves or each other.
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
Offset of a face's loops
The offset outline of a face, back in 3D.
p = u·x + v·y + n·h, h = p₀ · n
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
Offset of a chain of edges
The offset of a connected run of edges lying in one plane.
Arcs, circles, smooth curves, divide and offset m3d/model.js64-bit- CadCraft
- ModelCraft
-
Vertex a dimension end attaches to
Finds the vertex at a picked point so the dimension follows the geometry.
|M · q − p| ≤ 100 × EPS
Dimensions and typed sizes in 3D m3d/model.js64-bit- CadCraft
- ModelCraft
-
Where a dimension end is now
The current world position of a dimension's end.
p = M · q
Dimensions and typed sizes in 3D m3d/model.js64-bit- CadCraft
- ModelCraft
-
Radius and center of a dimensioned curve
The world center, radius and normal a radius or diameter dimension reads.
C = M · c; r = |C − M · p₀|
Dimensions and typed sizes in 3D m3d/model.js64-bit- CadCraft
- ModelCraft
-
Typing a new value into a dimension
Resizes the model so a dimension shows the typed length, radius or diameter.
radius: r_local′ = r_local × want ÷ r_world; length: see resize between two ends
Dimensions and typed sizes in 3D m3d/model.js64-bit- CadCraft
- ModelCraft
-
Resize between two ends
Moves one or both ends so the distance between them is the typed length.
δ = L − |p_b − p_a|, applied along the unit direction from a to b
Dimensions and typed sizes in 3D m3d/model.js64-bit- CadCraft
- ModelCraft
-
Moving the end of a dimension
Carries the move into the group that holds the moving end and stretches or moves the geometry there.
d_local = M⁻¹ · d (direction); s = |d_local|; local move = δ × s
Dimensions and typed sizes in 3D m3d/model.js64-bit- CadCraft
- ModelCraft
-
Typing a new length for an edge
Sets an edge to a typed length by moving one of its ends.
Dimensions and typed sizes in 3D m3d/model.js64-bit- CadCraft
- ModelCraft
-
Typing a new size for a group
Sets a group's or component's size along one of its own axes.
δ = size − (max − min) on that axis
Dimensions and typed sizes in 3D m3d/model.js64-bit- CadCraft
- ModelCraft
-
Bounding box
The smallest axis-aligned box round a group and everything placed in it.
min and max of M · p over every vertex
Dimensions and typed sizes in 3D m3d/model.js64-bit- CadCraft
- ModelCraft
-
Length of a linear dimension
The length a dimension between two points shows, and where its line is drawn.
L = |p_b − p_a|
Dimensions and typed sizes in 3D m3d/infer.js64-bit- CadCraft
- ModelCraft
-
Value of a radius or diameter dimension
The radius or diameter a dimension on an arc or circle shows.
L = r, or 2 × r for a diameter
Dimensions and typed sizes in 3D m3d/infer.js64-bit- CadCraft
- ModelCraft
-
Value of an angle dimension
The angle a dimension at a corner shows.
θ = atan2(v · (n × u), v · u); the dimension shows θ or π − θ
Dimensions and typed sizes in 3D m3d/infer.js64-bit- CadCraft
- ModelCraft
-
Angle label
The text of an angle dimension, in degrees.
degrees = round(θ × 180 ÷ π × 10) ÷ 10
Dimensions and typed sizes in 3D m3d/infer.js64-bit- CadCraft
- ModelCraft
-
World matrix of a nested placement
The matrix that takes a group's own coordinates to the model's, through every group it sits in.
M_world = M₁ · M₂ · … · Mₖ
Groups, placements and the model file m3d/model.js64-bit- CadCraft
- ModelCraft
-
Editing context of an open group
The world matrix of the group being edited and its inverse, used to take picked points into the group.
M = M₁ · … · Mₖ; M⁻¹ by cofactors
Groups, placements and the model file m3d/model.js64-bit- CadCraft
- ModelCraft
-
Making a group
Moves the selected geometry into a new group whose origin is the lowest corner of its box.
p_group = p − origin; placement = translation(origin)
Groups, placements and the model file m3d/model.js64-bit- CadCraft
- ModelCraft
-
Exploding a group
Puts a group's geometry back into its parent at the group's place.
p_parent = M · p
Groups, placements and the model file m3d/model.js64-bit- CadCraft
- ModelCraft
-
Flattening a group into a mesh
Gathers a group and everything placed in it into one set of points before it becomes a mesh.
key = round(x × 1e8), round(y × 1e8), round(z × 1e8)
Groups, placements and the model file m3d/model.js64-bit- CadCraft
- ModelCraft
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.