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
-
Values of a range
The values a, a + s, a + 2s … up to b.
x_k = a + k × s
CraftScript array arithmetic cs-tensor.js64-bit- PartCraft
-
Sum, product, mean, maximum and minimum
Reduces an array along one dimension.
mean = (Σ xₖ) ÷ n
CraftScript array arithmetic cs-tensor.js64-bit- PartCraft
-
Triangle normal
The unit normal of one triangle and twice its area.
n = (b − a) × (c − a); unit normal = n ÷ |n|
Planar faces of a mesh faces.js64-bit- PartCraft
-
Coplanar triangle groups
Joins triangles that share an edge and lie in one plane.
n₁ · n₂ > 1 − 1e-5 and |d₁ − d₂| < 1e-5 × max(1, max |coordinate|)
Planar faces of a mesh faces.js64-bit- PartCraft
-
Groups from the kernel's faces
Uses the kernel's own face of each triangle as the group.
Planar faces of a mesh faces.js64-bit- PartCraft
-
Face outline and area in its plane
The outline loops of a planar face in two dimensions and the face's area.
area = ½ Σ (x_j y_i − x_i y_j)
Planar faces of a mesh faces.js64-bit- PartCraft
-
Dropping collinear outline vertices
Removes outline vertices that lie on a straight run.
|u × v| ÷ (|u| |v|) < 1e-6 and u · v > 0
Planar faces of a mesh faces.js64-bit- PartCraft
-
One subdivision step
New face, edge and vertex points of the cage refined once.
smooth vertex = Q ÷ n + 2R ÷ n + (n − 3) v ÷ n; crease vertex = (a + 6v + b) ÷ 8; edge = mean of its ends and the two face points
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Limit position of a vertex
Where a vertex ends up on the smooth surface.
smooth: (n² v + 4 Σ e + Σ f) ÷ (n (n + 5)); crease: (a + 4v + b) ÷ 6; corner: v
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Limit surface normal at a vertex
The unit normal of the smooth surface at an interior vertex.
A = 1 + cos(2π ÷ n) + cos(π ÷ n) √(2 (9 + cos(2π ÷ n))); normal = t₁ × t₂ ÷ |t₁ × t₂|
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Bézier patch of one quad
The 16 control points of the bicubic patch for one face of the refined cage.
b = M G Mᵀ with rows of M: (1, 4, 1, 0) ÷ 6, (0, 4, 2, 0) ÷ 6, (0, 2, 4, 0) ÷ 6, (0, 1, 4, 1) ÷ 6; across a sharp edge: 2 × edge − inner
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Point on a patch
Evaluates a bicubic Bézier patch at (u, v).
S(u, v) = Σᵢ Σⱼ Bᵢ(u) Bⱼ(v) b_ij, B = ((1 − u)³, 3u(1 − u)², 3u²(1 − u), u³)
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Normal of a patch
The unit normal of a patch at (u, v).
n = ∂S/∂u × ∂S/∂v, normalized
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Refinement level for conversion
How many times the cage is refined before it is turned into patches.
level = max(1 if any face is not a quad, ⌈largest semi-sharp weight − 1e-12⌉), at most 4
Freeform bodies: subdivision surface and cage edits form.jsExact- PartCraft
-
How well the patches meet
The largest gap and the largest angle between normals across shared patch edges.
gap = max |p₀ − p₁|; angle = acos(clamp(n₀ · n₁, −1, 1)) × 180 ÷ π
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Fitting a cage to a target surface
Moves cage vertices until their limit points lie on a sphere or torus.
p ← p + (proj(L) − L), L the vertex's limit point
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Torus cage
The vertices of a torus-shaped starting cage.
((R + r cos b) cos a, r sin b, (R + r cos b) sin a), a = 2π i ÷ n, b = 2π j ÷ m
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Mirror partners
Finds each vertex's partner across the symmetry plane.
q = p mirrored; partner when |v − q| ≤ 1e-6 × size
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Rebuilding the mirrored half
Keeps one side of the symmetry plane and mirrors it.
mirror: x' = 2 × at − x
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Moving, rotating and scaling vertices
Applies a 4 × 4 transform to the selected vertices, with an optional soft falloff and mirrored motion.
p' = p + w (M p − p); soft weight w = (1 − (d ÷ R)²)²
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Extruding faces
Moves a region of faces along its averaged normals and adds side walls.
new vertex = v + dist × (Σ face normals at v) ÷ |Σ face normals at v|
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Face normal
The area-weighted normal of a cage face with any number of corners.
n_x = Σ (p_y − q_y)(p_z + q_z), and cyclic
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Flattening vertices onto a plane
Projects the selected vertices onto a given plane or their best-fit plane.
p' = p − n ((p − o) · n)
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Best-fit plane normal
The direction in which a set of centered points varies least.
A = Σ p pᵀ; normal = eigenvector of the smallest eigenvalue
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Adding a face through points
Adds a face, reusing existing vertices that are close to the given points.
reuse a vertex when |q − p| ≤ 1e-6
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Bridging two loops
Joins two loops of equal size with rows of quads.
offset = argmin Σ |aᵢ − b₍offset − i₎|²; row vertex = a + (b − a) × r ÷ segments
Freeform bodies: subdivision surface and cage edits form.js64-bit- PartCraft
-
Tolerance and roughness text
The text of a tolerance value or an Ra value on the drawing.
text = value rounded to 4 decimals
Drawing annotations: tolerance frames, datums and surface finish gdt.js64-bit- PartCraft
-
Circle and arc points
The points of a circle or arc in a symbol.
(c_x + r cos t, c_y + r sin t), t = a₀ + sweep × i ÷ n
Drawing annotations: tolerance frames, datums and surface finish gdt.js64-bit- PartCraft
-
Annotation layout
The frame, compartments, leader, datum triangle and surface texture legs of one annotation.
frame height = 2h; datum triangle height = side × √3 ÷ 2; texture legs at 60°: offset = leg ÷ tan(π ÷ 3)
Drawing annotations: tolerance frames, datums and surface finish gdt.js64-bit- PartCraft
-
Point on the handle axis nearest the pointer ray
How far along the handle's axis the pointer is, read from the pointer's ray.
t = (b·e − c·d) ÷ (a·c − b²)
Depth and angle set by dragging a handle handle-math.js64-bit- PartCraft
-
Dragged extrude depth
The depth stored on the Extrude after a drag.
depth = max(step, round((v₀ + scale × (t − t₀)) ÷ step) × step), step = max(0.01, 10^⌊log₁₀|v₀|⌋ ÷ 10)
Depth and angle set by dragging a handle handle-math.js64-bit- PartCraft
-
Dragged revolve angle
The angle stored on the Revolve after a drag.
angle = atan2(q·w, q·u) in degrees, unwrapped toward the previous value, rounded to 1°, kept in 1…360
Depth and angle set by dragging a handle handle-math.js64-bit- PartCraft
-
Sketch plane from a picked flat face
The plane reference stored when a sketch is put on a picked flat face that has no stable name.
o = each coordinate rounded to 9 decimals; n = each component rounded to 12 decimals
Values stored from picks in the workspace partcraft.js64-bit- PartCraft
-
Mate plane from a picked face of an instance
The plane stored in an assembly mate when a flat face of a placed part is picked.
o rounded to 9 decimals, n to 12 decimals, when the face has no stable name
Values stored from picks in the workspace partcraft.js64-bit- PartCraft
-
Anchor point on a drawing view
The point in a view's own coordinates where a note, dimension or detail view is attached.
u = u₀ + (x − x_view) ÷ scale, snapped to the nearest drawn line within 2.5 ÷ scale, then rounded to 4 decimals
Values stored from picks in the workspace partcraft.js64-bit- PartCraft
-
Default section plane offset
The offset of a new section view's cutting plane: the middle of the part's bounding box along the view direction.
offset = dir · (min + max) ÷ 2, rounded to 4 decimals
Values stored from picks in the workspace partcraft.js64-bit- PartCraft
-
Scale factors
The three factors a scale feature multiplies by, from the feature or from its shrinkage allowance.
Scale feature for printing print-features.js64-bit- PartCraft
-
Scale matrix about a fixed point
The 4 × 4 matrix that scales a body about the center, minimum corner, base center or origin of its box.
a = (min + max) ÷ 2 (center); translation = a × (1 − f)
Scale feature for printing print-features.js64-bit- PartCraft
-
Scaled triangles
Applies the scale to every corner of a body's triangles, with the box found from the triangles themselves.
x′ = f_x·x + t_x; y′ = f_y·y + t_y; z′ = f_z·z + t_z
Scale feature for printing print-features.js64-bit- PartCraft
-
Rotation about an axis
Turns a vector about a unit axis by an angle; used for a plane at an angle to another.
v′ = v·cos a + (u × v)·sin a + u·(u · v)·(1 − cos a)
Reference planes, axes and points refgeom.js64-bit- PartCraft
-
Point where three planes meet
The single point that lies on three planes.
solve [nₐ; n_b; n_c] · p = (nₐ·oₐ, n_b·o_b, n_c·o_c)
Reference planes, axes and points refgeom.js64-bit- PartCraft
-
Axis where two planes meet
The line of intersection of two planes: its direction and a point on it.
d = nₐ × n_b; solve nₐ·x = cₐ, n_b·x = c_b, d·x = d·(oₐ + o_b) ÷ 2
Reference planes, axes and points refgeom.js64-bit- PartCraft
-
Offset plane and plane at an angle
A plane parallel to another at a distance, and a plane turned about an axis by an angle in degrees.
o′ = o + n·d; n′ = rotate(n ⊥ axis, axis, angle × π ÷ 180)
Reference planes, axes and points refgeom.js64-bit- PartCraft
-
Plane through three points
The plane through three points, with its center at their mean.
n = (b − a) × (c − a); center = (a + b + c) ÷ 3
Reference planes, axes and points refgeom.js64-bit- PartCraft
-
Mid plane between two planes
The plane half way between two planes, or the one that bisects them when they are not parallel.
n = (nₐ − n_b) ÷ |nₐ − n_b|; c = (oₐ·nₐ − o_b·n_b) ÷ |nₐ − n_b|; parallel and same facing: o = oₐ + n·((o_b − oₐ)·n) ÷ 2
Reference planes, axes and points refgeom.js64-bit- PartCraft
-
Plane tangent to a cylinder
The plane that touches a cylindrical face on the side of a chosen point.
radial = w − d·(w · d); n = radial ÷ |radial|; o = foot on the axis + n·r
Reference planes, axes and points refgeom.js64-bit- PartCraft
-
Plane through a line and a point
The plane that contains a straight edge or axis and one more point.
n = d × (p − o)
Reference planes, axes and points refgeom.js64-bit- PartCraft
-
Where a line meets a plane or a cylinder
The point where a straight edge or axis crosses a plane, a flat face or a cylindrical face.
plane: t = ((o_s − o) · n) ÷ (d · n); cylinder: A·t² + B·t + C = 0, t = (−B ± √(B² − 4AC)) ÷ 2A
Reference planes, axes and points refgeom.js64-bit- PartCraft
-
Point on a curve at a parameter
The point of a line, circle, arc or spline at a given parameter.
line: a + (b − a)·t; circle: c + r·(cos t, sin t); arc: c + r·(cos(a₀ + t), sin(a₀ + t))
Sketch intersections of lines, arcs and circles sketch-intersect.js64-bit- PartCraft
-
Parameter of the nearest point
The parameter on a curve of the point nearest a given point.
line: t = ((p − a) · d) ÷ (d · d); circle and arc: angle = atan2(p_y − c_y, p_x − c_x)
Sketch intersections of lines, arcs and circles sketch-intersect.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.