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
-
Faces that lie on the plate's plane
Decides which flat faces of the body belong to the plate, by distance from the sketch plane and by direction.
size = max(1, largest distance of a face centroid from the origin); tol = 1e-6 × size; on the plane when |n · (c − o)| ≤ tol and | |n_face · n| − 1 | ≤ 1e-9
Sheet metal bends and flat pattern sheet-flat.js64-bit- PartCraft
-
Unfolding a flange
Turns a flange's leg back into the plate's plane and adds the bend strip between the plate and the leg.
leg: rotate by −θ about the bend axis through C, then move by BA along u; strip: S₀, S₀ + e·run, + u·BA; bend line at S₀ + u × BA ÷ 2
Sheet metal bends and flat pattern sheet-flat.js64-bit- PartCraft
-
Outline edges as lines, arcs and circles
Reads each edge of the fused flat as a 2-D line, arc, circle or sampled curve in the sketch plane.
2-D point = ((p − o) · x, (p − o) · y); arc angles = atan2(Δy, Δx) × 180 ÷ π, brought to [0, 360)
Sheet metal bends and flat pattern sheet-flat.js64-bit- PartCraft
-
Box and area of the flat pattern
The overall size of the flat pattern and its area.
box = min and max over line ends, sampled curve points and 65 points per arc; area = surface area of the fused flat
Sheet metal bends and flat pattern sheet-flat.js64-bit- PartCraft
-
Automatic element size
A tidy element size that gives about the target number of elements for a solid of a given volume.
raw = ∛(volume ÷ target); size = next step ≥ raw among 1, 1.25, 1.5, 2, 2.5, 3, 4, 5, 6, 8 × 10ⁿ
Study set-up: element size and the mesh handed to the solver sim.js64-bit- PartCraft
-
Estimated element count
The element size a study will use and the number of elements that size is expected to give.
estimate = round(volume ÷ h³) (× 12 for tetrahedra)
Study set-up: element size and the mesh handed to the solver sim.js64-bit- PartCraft
-
Mesh copy for the solver
Copies the body's triangle mesh for the worker that meshes and solves the study.
Study set-up: element size and the mesh handed to the solver sim.js32-bit in part- PartCraft
-
Design box and size of a generative study
The design space of a generative study (the body's box grown by a margin), its volume, element size and estimated element count.
box = bbox ± margin; volume = Δx × Δy × Δz (box) or the body's volume; estimate = round(volume ÷ h³)
Study set-up: element size and the mesh handed to the solver sim.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
-
Line and line
The parameters at which two lines cross.
den = d₁ × d₂; tₐ = (w × d₂) ÷ den; t_b = (w × d₁) ÷ den, w = B.a − A.a
Sketch intersections of lines, arcs and circles sketch-intersect.js64-bit- PartCraft
-
Line and circle
The parameters along a line at which it crosses a circle.
A·t² + B·t + C = 0; q = −½·(B + sign(B)·√(B² − 4AC)); t₁ = q ÷ A, t₂ = C ÷ q
Sketch intersections of lines, arcs and circles sketch-intersect.js64-bit- PartCraft
-
Circle and circle
The points where two circles cross.
a = (r₁² − r₂² + d²) ÷ 2d; h = √(r₁² − a²); points = c₁ + a·û ± h·û⊥
Sketch intersections of lines, arcs and circles sketch-intersect.js64-bit- PartCraft
-
Is a crossing on the bounded curve
Decides whether a crossing lies on the drawn part of a line or arc, and snaps it to the end when it is within the tolerance.
line: −eps ÷ L ≤ t ≤ 1 + eps ÷ L; arc: angle ≤ sweep + eps ÷ r
Sketch intersections of lines, arcs and circles sketch-intersect.js64-bit- PartCraft
-
Crossing points of two curves
All crossing points of two sketch curves, sorted along the first.
eps = 1e-9 × max(1, size of A, size of B); duplicates within 10 × eps removed
Sketch intersections of lines, arcs and circles sketch-intersect.js64-bit- PartCraft
-
Roots of a function along a span
Finds the parameters where a signed distance along the spline is zero.
sample n steps; bisect each sign change until b − a ≤ 1e-16 × max(1, |a|)
Sketch intersections with splines sketch-intersect.js64-bit- PartCraft
-
Spline against a line or circle
Collects the spline parameters where it crosses a line or a circle, span by span.
24 samples per knot span of F(S(u)); line: F = signed distance; circle: F = |S − c| − r
Sketch intersections with splines sketch-intersect.js64-bit- PartCraft
-
Spline against spline
The parameter pairs at which two splines cross.
Newton: [S₁′(u) −S₂′(v)] · (Δu, Δv) = −(S₁(u) − S₂(v))
Sketch intersections with splines sketch-intersect.js64-bit- PartCraft
-
Knot span of a parameter
Finds which knot span a parameter falls in.
Sketch splines: evaluation, fitting and exact pieces sketch-spline.jsExact- PartCraft
-
Basis functions
The values of the B-spline basis functions that are not zero at a parameter.
t = N[r] ÷ (right[r+1] + left[j−r]); N[r] = saved + right[r+1] × t; saved = left[j−r] × t (Cox–de Boor)
Sketch splines: evaluation, fitting and exact pieces sketch-spline.js64-bit- PartCraft
-
Basis function derivatives
The basis functions and their derivatives up to a given order at a parameter.
Sketch splines: evaluation, fitting and exact pieces sketch-spline.js64-bit- PartCraft
-
Point on a spline
The point of a spline at a parameter.
C(u) = Σⱼ Nⱼ(u) × Pⱼ (degree + 1 terms)
Sketch splines: evaluation, fitting and exact pieces sketch-spline.js64-bit- PartCraft
-
Derivatives of a spline
The point, tangent and higher derivatives of a spline at a parameter.
C⁽ⁱ⁾(u) = Σⱼ Nⱼ⁽ⁱ⁾(u) × Pⱼ
Sketch splines: evaluation, fitting and exact pieces sketch-spline.js64-bit- PartCraft
-
Chord-length parameters
Gives each fit point a parameter equal to the summed straight distances up to it.
tᵢ = tᵢ₋₁ + |Qᵢ − Qᵢ₋₁|
Sketch splines: evaluation, fitting and exact pieces sketch-spline.js64-bit- PartCraft
-
Dense linear solve
Solves the linear system that gives a fit spline its poles.
A · X = B by Gauss–Jordan elimination with partial pivoting
Sketch splines: evaluation, fitting and exact pieces sketch-spline.js64-bit- PartCraft
-
Spline through fit points
The cubic spline that passes through the given points, open with natural or given end directions, or closed and periodic.
rows: C(tᵢ) = Qᵢ; ends: C″ = 0 or C′ = (cos a, sin a); solve for the poles
Sketch splines: evaluation, fitting and exact pieces sketch-spline.js64-bit- PartCraft
-
Area term of a spline
The area term of a spline by Green's formula: the enclosed area when the spline is closed.
½ ∫ (x·y′ − y·x′) du, 3-point Gauss–Legendre per knot span (nodes ±√(3 ÷ 5), 0; weights 5/9, 8/9, 5/9)
Sketch splines: evaluation, fitting and exact pieces sketch-spline.js64-bit- PartCraft
-
Curvature of a spline
The signed curvature of a spline at a parameter.
κ = (x′·y″ − y′·x″) ÷ |C′|³
Sketch splines: evaluation, fitting and exact pieces sketch-spline.js64-bit- PartCraft
-
Knot insertion
Adds one knot to a spline without changing its shape.
a = (u − Uᵢ) ÷ (Uᵢ₊ₚ − Uᵢ); Qᵢ = (1 − a)·Pᵢ₋₁ + a·Pᵢ
Sketch splines: evaluation, fitting and exact pieces sketch-spline.js64-bit- PartCraft
-
Exact piece of a spline
The part of a spline between two parameters as a curve of its own, used by trim.
Sketch splines: evaluation, fitting and exact pieces sketch-spline.js64-bit- PartCraft
-
Knots rescaled to start at zero
Shifts and scales a spline's knots so that they start at 0 and span the number of its pieces.
u′ = (u − a) × (poles − degree) ÷ L
Sketch splines: evaluation, fitting and exact pieces sketch-spline.js64-bit- PartCraft
-
Polyline within a chord tolerance
Points along a spline such that every chord stays within a tolerance of the curve.
split a piece while the curve at ¼, ½ or ¾ of it is farther than tol from its chord
Sketch splines: length, nearest point, polyline and offset sketch-spline.js64-bit- PartCraft
-
Length of a spline
The arc length of a spline.
L = Σ over 8 pieces per span of Σ wᵢ × h × |C′(uᵢ)| (5-point Gauss–Legendre)
Sketch splines: length, nearest point, polyline and offset sketch-spline.js64-bit- PartCraft
-
Nearest point on a spline
The parameter of the point on a spline nearest a given point.
start at the nearest of 13 samples per span; Newton: u ← u − ((C − p) · C′) ÷ (C′ · C′ + (C − p) · C″)
Sketch splines: length, nearest point, polyline and offset sketch-spline.js64-bit- PartCraft
-
Offset of a spline
A new fit spline that follows a spline at a fixed distance, with the largest gap found.
true offset point = C(u) + d × n(u); err = max over 40 points per span of the distance to the fitted curve; accept when err ≤ tol
Sketch splines: length, nearest point, polyline and offset sketch-spline.js64-bit- PartCraft
-
Sketch tolerance
The base length tolerance of the sketch tools.
tolOf = 1e-7 × max(1, extent of the sketch)
Sketch tools: trim, extend, offset, mirror, pattern, polygon, slot, project sketch-tools.js64-bit- PartCraft
-
Crossings of a curve with the others
Where a curve is cut by every other curve of the sketch, for trim.
crossings within tol of the curve's own ends, or of one already found, are left out; tol = 1e-4 × max(1, extent)
Sketch tools: trim, extend, offset, mirror, pattern, polygon, slot, project sketch-tools.js64-bit- PartCraft
-
Extending a line or arc
Moves the picked end of a line or arc to the nearest curve it meets when continued.
line: gap = (t − 1) × L or −t × L; arc: gap = (t − sweep) × r or (2π − t) × r; nearest gap > tol wins
Sketch tools: trim, extend, offset, mirror, pattern, polygon, slot, project sketch-tools.js64-bit- PartCraft
-
Offset of each curve
The offset copy of each line, circle, arc or spline of a chain, before the corners are joined.
line: S = a + d·n, E = b + d·n, n = (−Δy, Δx) ÷ L; circle: r − d; arc: r ∓ d, ends c + r·(cos, sin)
Sketch tools: trim, extend, offset, mirror, pattern, polygon, slot, project sketch-tools.js64-bit- PartCraft
-
Corners of an offset chain
Joins neighboring offset curves at the point where they meet when extended.
corner = the intersection of the two full lines or circles nearest the midpoint of the gap
Sketch tools: trim, extend, offset, mirror, pattern, polygon, slot, project sketch-tools.js64-bit- PartCraft
-
Mirror about a line
Reflects points about a sketch line, and reflects a spline's end angles.
t = (p − a) · u; q = a + t·u; p′ = 2q − p; angle′ = 2φ − angle
Sketch tools: trim, extend, offset, mirror, pattern, polygon, slot, project sketch-tools.js64-bit- PartCraft
-
Linear pattern
Copies geometry a number of times along a step.
copy i: (x + Δx × i, y + Δy × i)
Sketch tools: trim, extend, offset, mirror, pattern, polygon, slot, project sketch-tools.js64-bit- PartCraft
-
Circular pattern
Copies geometry a number of times around a center.
step = (360 ÷ count, or angle ÷ (count − 1)) × π ÷ 180; copy i: rotate about c by step × i
Sketch tools: trim, extend, offset, mirror, pattern, polygon, slot, project sketch-tools.js64-bit- PartCraft
-
Regular polygon
The corners of a regular polygon from its center, one corner and the number of sides.
cornerᵢ = c + r × (cos(a₀ + 2π·i ÷ n), sin(a₀ + 2π·i ÷ n))
Sketch tools: trim, extend, offset, mirror, pattern, polygon, slot, project sketch-tools.js64-bit- PartCraft
-
Straight slot
The four corner points of a slot from its two centers and its width.
r = w ÷ 2; corners = center ± n × r, n = unit normal of the center line
Sketch tools: trim, extend, offset, mirror, pattern, polygon, slot, project sketch-tools.js64-bit- PartCraft
-
Projecting a model edge
Puts a straight or circular model edge onto the sketch plane as fixed geometry.
(u, v) = ((p − o) · x, (p − o) · y)
Sketch tools: trim, extend, offset, mirror, pattern, polygon, slot, project sketch-tools.js64-bit- PartCraft
-
Radius of a circle or arc
The radius of a circle (stored) or of an arc (the distance from its center to its start point).
r = |s − c|
Sketch geometry and measured values sketch.js64-bit- PartCraft
-
Arc angles
The center, radius, start angle and sweep of an arc from its three points.
a₀ = atan2(s − c); sweep = atan2(e − c) − a₀, brought to (1e-12, 2π]
Sketch geometry and measured values sketch.js64-bit- PartCraft
-
New arc: end point on the radius
Places a new arc's end point on the circle through its start point.
r = |s − c|; e = c + r × (cos a, sin a), a = atan2(e₀ − c)
Sketch geometry and measured values sketch.js64-bit- PartCraft
-
Current value of a relation or dimension
The value a new dimension starts with: a distance, a horizontal or vertical distance, a radius, a diameter, an offset or an angle, and which side it is on.
distance = |b − a|; point to line = |signed distance|; diameter = 2r; angle° = |atan2(u × v, u · v)| × 180 ÷ π
Sketch geometry and measured values sketch.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.