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
-
Material below a point
Whether there is part material just under a height at (x, y), used to tell a through hole from a blind one.
first surface below z faces up
Part and stock in machine coordinates cam.js32-bit in part- PartCraft
-
Circles of round edges
The center and radius of each circular edge lying in a plane square to the tool.
full circle: c = (a + mid) ÷ 2, r = |a − mid| ÷ 2; arc: circle through a, mid, b
Part and stock in machine coordinates cam.js64-bit- PartCraft
-
Circle through three points
The center and radius of the circle through three 2D points.
d = 2 (a_x (b_y − c_y) + b_x (c_y − a_y) + c_x (a_y − b_y)); u_x = (|a|² (b_y − c_y) + |b|² (c_y − a_y) + |c|² (a_y − b_y)) ÷ d
Part and stock in machine coordinates cam.js64-bit- PartCraft
-
Arc from start, middle and end
The signed sweep of an arc about a known center that passes from a start through a middle point to an end.
counterclockwise when mod(a_m − a₀, 2π) < mod(a₁ − a₀, 2π); sweep = ± mod(a₁ − a₀, 2π)
Part and stock in machine coordinates cam.js64-bit- PartCraft
-
Exact outline of a flat face
Turns a face's mesh boundary into lines and arcs whose ends are the exact edge ends.
mesh corner within tol of an edge end → that end; mesh run within tol of an edge circle → arc on that circle
Part and stock in machine coordinates cam.js64-bit- PartCraft
-
Hole position, size and depth
The center, radius, top and bottom of a round face along the tool axis, and whether it is a hole and goes through.
c, r from the exact cylinder; top, bottom = mesh z range snapped to an edge end within tol
Part and stock in machine coordinates cam.js64-bit- PartCraft
-
Chaining picked edges into a loop
Orders picked edges into one closed outline and makes each start exactly on the previous end.
ends join when closer than tol; then next.start = previous.end
Part and stock in machine coordinates cam.js64-bit- PartCraft
-
Length of a line or arc
The length of one piece of an outline or toolpath.
line: |e − s|; arc: |sweep| × r
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Point along a piece
The point a given fraction of the way along a line or arc.
line: s + (e − s) t; arc: c + r (cos, sin)(a₀ + sweep × t)
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Is an angle on an arc
Whether a direction from the center falls within an arc, and how far along.
u = mod(±(a − a₀), 2π); on the arc when u ≤ |sweep| + eps; t = u ÷ |sweep|
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Distance from a point to a line or arc
The shortest distance from a point to one piece of an outline.
line: |q − (s + d × clamp(((q − s) · d) ÷ |d|², 0, 1))|; arc: ||q − c| − r| when the direction is on the arc, else the nearer end
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Signed area of a loop
The area enclosed by a loop of lines and arcs, positive when counterclockwise.
A = ½ Σ [line: s × e; arc: r c_x (sin a₁ − sin a₀) − r c_y (cos a₁ − cos a₀) + r² × sweep]
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Winding number
How many times the loops wind round a point, which says whether the point is inside.
count signed crossings of a ray to +x; arc crossing at x = c_x ± √(r² − (q_y − c_y)²)
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Line and line
The point where two line pieces cross, or the ends of their overlap when they lie on one line.
t_a = ((B.s − A.s) × s) ÷ (r × s); parallel when |r × s| ≤ 1e-12 |r| |s|
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Line and arc
The points where a line piece meets an arc.
a t² + b t + c = 0; t = (−b ± √(b² − 4ac)) ÷ 2a
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Arc and arc
The points where two arcs meet.
a = (r_A² − r_B² + d²) ÷ 2d; h = √(r_A² − a²); p = c_A + a u ± h n
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Raw offset of a loop
Moves every piece of a loop sideways by the offset and joins the corners with arcs.
line: s, e + d × left normal; arc: r ∓ d; corner arc radius d, sweep = atan2(t_a × t_b, t_a · t_b)
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Splitting pieces at intersections
Cuts every offset piece where it meets another.
cut at parameter t unless within 1e-5 mm of an end or of the previous cut
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Offset of a region
The outline at a fixed distance inside or outside a region, which is the path of the tool center.
keep a piece when dist(midpoint, original outline) ≥ d − 1e-6 and the midpoint is on the offset side
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Chaining pieces into loops
Joins the kept pieces end to start into closed loops.
next piece starts within 4e-5 mm of the current end; sharpest left turn wins; then next.start = current.end
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Merging collinear lines and co-circular arcs
Joins neighboring pieces that lie on the same line or circle into one.
lines: |u × v| < 1e-10 and end within 1e-9 mm of the line; arcs: centers and radii within 1e-9 mm, same direction
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Splitting arcs to half turns
Cuts arcs so none sweeps more than 180°, as G-code controls expect.
n = ceil(|sweep| ÷ π); piece i from a₀ + sweep × i ÷ n
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Points along a piece at a chord tolerance
Sample points no farther than a tolerance from an arc, for checks and drawing.
step angle = 2 acos(1 − tol ÷ r)
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Bounding box of a piece
The extent of a line or arc, including where an arc bulges past its ends.
ends, plus c ± r along each axis direction the arc passes
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Splitting a loop at distances along it
Cuts a loop at given distances from its start, used for tabs and ramps.
t = (cut − length so far) ÷ piece length
2D curve offsets for toolpaths cam-offset.js64-bit- PartCraft
-
Depth levels
The heights of the passes between the top and the bottom of a cut.
n = ceil((top − bottom) ÷ stepdown − 1e-9); z_i = top − (top − bottom)(i + 1) ÷ n; last = bottom
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
Clearance, retract and cut heights
The heights an operation moves at, from the stock top and the operation's settings.
clearance = stock top + clearance; retract = min(clearance, stock top + retract); bottom = geometry bottom + offset
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
Arc move with changing height
Writes one line or arc as moves, splitting an arc into half turns and sharing the height change among them.
z after a piece = z + (z₁ − z₀) × piece length ÷ arc length; last piece ends at z₁
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
Ramp along a path
Lowers the tool linearly while it follows a chain of lines and arcs.
z = z₀ + (z₁ − z₀) × length so far ÷ total length
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
Facing rows
The positions of the back-and-forth rows that face the stock.
n = ceil(width ÷ (stepover × d) − 1e-9); row_i = b₀ + (b₁ − b₀) i ÷ n; run from a₀ − R − overhang to a₁ + R + overhang
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
Pocket offset levels
The successive inward offsets a pocket is cleared along.
level k at distance d₀ + k × stepover, until nothing is left
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
Helix entry
The half-turn arcs that take the tool down into a pocket at a set ramp angle.
pitch = 2π ρ tan(angle); half turns = ceil((z_from − z) ÷ (pitch ÷ 2) − 1e-9); z after half turn i = z_from − (z_from − z)(i + 1) ÷ n
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
Ramp entry along a loop
How far along the first loop the tool travels while ramping down a level.
length needed = (z_from − z) ÷ tan(angle); whole loops = floor(needed ÷ L); remainder split off the loop
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
Contour offset
The path of the tool center round an outline.
d = R + stock to leave; outside: offset by −d (grow); inside: offset by +d
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
Lead-in and lead-out arcs
Quarter-circle arcs that bring the tool onto and off a contour through the air side.
center = start + ρ × left normal; quarter turn ending (or starting) at the contour's start; ρ halved up to 4 times until the arc is in air
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
Holding tabs
Where the tool lifts over tabs that keep the part attached.
tab k centered at (k + ½) L ÷ tabs; lifted over tab width + tool diameter; tab top = bottom + tab height
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
Drill depth and R plane
How deep each hole is drilled and the height the drill returns to between holes.
through: z = bottom − breakthrough − (tip length when full diameter is asked); R = min(retract, highest stock or part near the hole + R plane)
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
Highest point between two holes
The highest part or stock under the drill as it moves from one hole to the next.
max of heights at 9 points across the tool, every 1 mm along the move
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
Chamfer depth and offset
How deep and how far out a chamfer mill runs to cut a chamfer of a given width.
β = tool angle ÷ 2; depth = width ÷ tan β; offset = tip radius + tip offset × tan β; z = edge height − depth − tip offset
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
Engagement angle of adaptive clearing
The angle of the cutter's rim in material for a set cutting width, listed with the operation.
angle = acos(1 − min(1, w ÷ R)) × 180 ÷ π
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
Length of a toolpath segment
The length of a straight or helical move, used for the machining time.
line: |b − a|; arc: √((|sweep| × r)² + Δz²)
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
Points along a toolpath segment
Sample points along an arc move for the simulation overlay and checks.
step angle = 2 acos(1 − tol ÷ r); point i at a₀ + sweep × i ÷ n, z linear
2.5-axis toolpaths cam-paths.js64-bit- PartCraft
-
One-dimensional squared distance transform
For each cell of a row, the squared distance to the nearest marked cell, by lower envelopes of parabolas.
d(q) = min_p ((q − p)² + f(p)); parabolas meet at s = ((f(q) + q²) − (f(p) + p²)) ÷ (2q − 2p)
Adaptive clearing passes cam-adaptive.js64-bit- PartCraft
-
Distance to the nearest marked cell
The straight-line distance, in cells, from every cell to the nearest cell of a mask.
columns then rows of the 1D transform; distance = √(squared distance)
Adaptive clearing passes cam-adaptive.js64-bit- PartCraft
-
Grid over the region
Lays a grid over the region and stores, per cell, whether it is inside and its exact distance to the walls.
cell h = R ÷ 12 (× 1.25 until the grid fits); wall distance from the region's lines and arcs
Adaptive clearing passes cam-adaptive.js64-bit- PartCraft
-
Contour of the distance field
Traces the line where the field crosses zero, which becomes a pass.
crossing on a cell edge at t = a ÷ (a − b)
Adaptive clearing passes cam-adaptive.js64-bit- PartCraft
-
Field whose contour is the next pass
Sets up the field that is zero where the tool center cuts the set width into the remaining material.
F = (R − w) − distance to material (allowed cells); positive elsewhere
Adaptive clearing passes cam-adaptive.js64-bit- PartCraft
-
Keeping passes off the walls
Moves any pass point that came nearer the walls than the tool radius plus stock to leave.
p ← nearest wall point + unit(p − nearest) × (R + leave + 1e-6)
Adaptive clearing passes cam-adaptive.js64-bit- PartCraft
-
Simplifying a pass
Drops points of a pass that lie within a tolerance of the line between their neighbors.
keep the point farthest from the chord when its distance > cell ÷ 4, then repeat on both halves
Adaptive clearing passes cam-adaptive.js64-bit- PartCraft
-
Marking what a pass clears
Marks every grid cell the tool covers along a pass.
cell cleared when its center is within R of the segment
Adaptive clearing passes cam-adaptive.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.