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
-
Host doors and windows onto the nearest wall
Puts each door or window of the host model on the room wall nearest its middle, with its offset along that wall.
s = (p − a)·u; off = |(p − a) × u|; at = clamp(s − w ÷ 2, 0, len − w)
Room outline, walls and openings addons/cabinetcraft/lib/fromroom.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Room point back in the host's axes
Converts a point in the room's own axes to millimeters in the host model.
X = ox + x × k, k = 25.4 for an inch job, else 1
Room outline, walls and openings addons/cabinetcraft/lib/fromroom.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Island frames
The origin and axes of each island's front row and back row.
u = (cos a, sin a), a = rot × π ÷ 180; back row origin = o + u × len
Cabinet run layout and countertops addons/cabinetcraft/lib/project.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Layout tolerance and largest automatic filler
The two limits the layout compares against.
tol = 0.01; maxFiller = conv(75, unit)
Cabinet run layout and countertops addons/cabinetcraft/lib/project.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
End-face swing of a cabinet on a bay
How far the end face of a straight cabinet on a curved bay swings toward the neighboring run.
tilt = d × sin(atan2(w ÷ 2, √(r² − w² ÷ 4)))
Cabinet run layout and countertops addons/cabinetcraft/lib/project.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Is a corner a right angle
Decides whether a corner cabinet fits a room corner.
square when |turn − 90| < 0.01 degrees
Cabinet run layout and countertops addons/cabinetcraft/lib/project.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Where the later run stops at a corner
How far short of a room corner a run stops so it clears the run on the other wall.
stop = flat + tilt(A) + tilt(B) + flat² ÷ (2r); flat = other run's depth at 90°
Cabinet run layout and countertops addons/cabinetcraft/lib/project.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Wedge filler triangle at an angled corner
The three corners of the triangular void left where two runs meet at an angle that is not 90 degrees.
tri = [corner, corner ± u × leg1, corner + n × depth]
Cabinet run layout and countertops addons/cabinetcraft/lib/project.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Automatic filler width
The width of the filler that closes the gap between the last cabinet and the end of the span.
rest = end − start − used; filler = rest when tol < rest ≤ maxFiller
Cabinet run layout and countertops addons/cabinetcraft/lib/project.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Position of each cell along its run
The distance from the start of the wall to each cabinet, filler and end panel.
xᵢ₊₁ = xᵢ + wᵢ; stored xᵢ rounded to 6 decimals
Cabinet run layout and countertops addons/cabinetcraft/lib/project.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
First cabinet on a curve moved clear of the previous run
On a curved wall that starts at a room corner, how far the first cabinet is moved along so it does not overlap the previous run's last cabinet.
bisection on [0, 600 mm], 40 halvings; clash when overlap > 1e-6
Cabinet run layout and countertops addons/cabinetcraft/lib/project.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Straight countertop length and width
The length and width of a countertop over a straight run of base cabinets.
length = x₁ − x₀ + overhang at each open end; width = depth + front overhang + seat
Cabinet run layout and countertops addons/cabinetcraft/lib/project.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Countertop on a curved wall
The outline and area of a one-piece countertop that follows cabinets stepped along a curved wall.
area = |Σ (xᵢ yᵢ₊₁ − xᵢ₊₁ yᵢ)| ÷ 2
Cabinet run layout and countertops addons/cabinetcraft/lib/project.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Corner cabinet countertop
The outline and area of the countertop over a corner cabinet.
area = shoelace of the outline; length = width = √area
Cabinet run layout and countertops addons/cabinetcraft/lib/project.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Extent of a cell along its wall
The stretch of wall each cell covers, used to test it against doors and windows.
curved wall: min and max of (corner − a)·u; straight: [x, x + w]
Cabinet run layout and countertops addons/cabinetcraft/lib/project.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
End panel height
The height of an end panel beside a cabinet.
height = cabinet height − kick height
Cabinet run layout and countertops addons/cabinetcraft/lib/project.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Wall frame to room coordinates
Turns a distance along a wall and a distance out from it into a room point.
p = o + u × s + n × o′
Cabinet run layout and countertops addons/cabinetcraft/lib/footprint.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Floor footprint of each cell
The polygon each cabinet and end panel covers on the floor, its bounding box and its height range.
Cabinet run layout and countertops addons/cabinetcraft/lib/footprint.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
How far two footprints overlap
The penetration depth of two convex polygons, 0 when they are apart or only touch.
for each edge normal n: overlap = min(a₁, b₁) − max(a₀, b₀) of the projections; result = smallest overlap
Cabinet run layout and countertops addons/cabinetcraft/lib/footprint.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Gap between two rectangles
The distance between two axis-aligned rectangles.
gap = √(dx² + dy²), dx and dy the clear distances on each axis, 0 when they overlap on it
Cabinet run layout and countertops addons/cabinetcraft/lib/footprint.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Gap between two sets of convex polygons
The smallest distance between two footprints made of convex pieces, 0 when they touch or overlap.
Cabinet run layout and countertops addons/cabinetcraft/lib/footprint.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
One cabinet in plan
The cabinet seen from above in its own frame, with its fronts, number and width label.
W = w × k; D = d × k; label = round(w × 100) ÷ 100
Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/draw.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Front view of a run
Each cabinet's box, plinth and fronts along the run, x along the wall and y up from the floor.
X = x × k; front at (X + f.x × k, base + f.y × k)
Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/draw.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Frame of a run from two wall points
The origin, angle and length of a run picked by two points on a wall and a point in the room.
len = √(Δx² + Δy²); left = (room − a) × u; ang = atan2(u_y, uₓ)
Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/draw.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Point in a run's frame
The distance along a run and out from the wall of a point.
s = Δx cos a + Δy sin a; off = −Δx sin a + Δy cos a
Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/draw.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Cabinet in section
The side panel, bottom, top or rails, back, shelves, plinth, fronts and drawer boxes of a cabinet cut through its middle.
shelf i of n: y = bottom + (top − bottom) × (i + 1) ÷ (n + 1) − t ÷ 2
Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/draw.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Drawing extent and SVG coordinates
The size of a drawing and the coordinates written into its SVG.
W = x₁ − x₀; H = y₁ − y₀; each coordinate written as round(v × 1e6) ÷ 1e6
Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/drawings.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Cabinets placed on the room plan
The rectangle of each cabinet, filler and end panel in room coordinates.
corner = toWorld(frame, s + x, o)
Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/drawings.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Room dimensions on the plan
The overall width and depth dimensions of the room.
label = fmtLen(W, unit)
Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/drawings.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Foreshortened width on a curved wall
The drawn width of a cabinet that is turned on a curved wall, in the elevation.
kₓ = max(0.05, (ext₁ − ext₀) ÷ w); drawn width = w × kₓ
Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/drawings.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Overall run length and height in the elevation
The total length of a run and the height to the top of its tallest cabinet.
length = b − a; top = max(elevation + height)
Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/drawings.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Section of one cabinet with dimensions
The section view of one cabinet with its face frame, fronts, overall depth and height.
depth shown = d + frame thickness + front thickness
Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/drawings.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Cabinet panels as boxes
The carcass panels, back, shelves, plinth and fronts of a cabinet as boxes in its own frame.
shelf i of n: z = bottom + (top − bottom) × (i + 1) ÷ (n + 1) − t ÷ 2
Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/solid.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Boxes placed in the drawing
The faces of each box in drawing coordinates, for the 3D tab.
X = x + lx cos r − ly sin r; Y = y + lx sin r + ly cos r; Z = (z + elev) × k
Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/solid.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Numbers read from a G-code line
Splits a line into its letter and number words.
G-code dry run and hole check addons/cabinetcraft/lib/dryrun.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Arc move length
The length of a G2 or G3 move in the XY plane, with any Z change.
r = |start − center|; sweep = a₁ − a₀ wrapped to the move's direction; len = √((r × |sweep|)² + Δz²)
G-code dry run and hole check addons/cabinetcraft/lib/dryrun.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Arc move extent
The bounding box of an arc move.
extent = end points ∪ {center + r × (cos q, sin q)} for q = 0°, 90°, 180°, 270° inside the sweep
G-code dry run and hole check addons/cabinetcraft/lib/dryrun.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Straight move length
The length and extent of a straight move.
len = √(Δx² + Δy² + Δz²)
G-code dry run and hole check addons/cabinetcraft/lib/dryrun.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Extent of the whole program
The smallest and largest X, Y and Z any move reaches.
G-code dry run and hole check addons/cabinetcraft/lib/dryrun.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Total cutting and rapid length
The summed length of the cutting moves and of the rapid moves.
cutLen = Σ len over cutting moves; rapidLen = Σ len over rapids
G-code dry run and hole check addons/cabinetcraft/lib/dryrun.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Deepest cut and cut through the stock
The lowest Z of any cutting move and how far it goes below the bottom of the sheet.
deepest = min z; through = max(0, −deepest − thickness)
G-code dry run and hole check addons/cabinetcraft/lib/dryrun.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Cutting and rapid time
The minutes the cutting moves and the rapids take at their feed rates.
minutesCut = Σ len ÷ feed; minutesRapid = rapidLen ÷ rapid rate
G-code dry run and hole check addons/cabinetcraft/lib/dryrun.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Hole edge distance
How close the rim of each face hole comes to the edge of its panel.
e = min(x − r, L − x − r, y − r, W − y − r), r = d ÷ 2
G-code dry run and hole check addons/cabinetcraft/lib/dryrun.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Rounding of reported values
Rounds a value of the report to 3 decimals.
r3(v) = round(v × 1000) ÷ 1000
G-code dry run and hole check addons/cabinetcraft/lib/dryrun.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Amount of one estimate row
The amount of a row from its quantity and rate.
amount = round(qty × rate × 100) ÷ 100; shown qty = round(qty × 1000) ÷ 1000
Cabinet job cost estimate addons/cabinetcraft/lib/estimate.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Price of one sheet
The price of a sheet of the job's size from the price of the stock sheet.
rate = round(base × (w × h × k²) ÷ (2440 × 1220), 2 decimals), k = 25.4 for an inch job
Cabinet job cost estimate addons/cabinetcraft/lib/estimate.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Number of sheets
How many sheets of a material the job needs.
nested: sheets used; else n = max(1, ⌈cut area × 1.15 ÷ (w × h)⌉)
Cabinet job cost estimate addons/cabinetcraft/lib/estimate.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Edge banding length priced
The meters of each edge banding, with waste, and its rate.
meters = length ÷ 1000 × k × (1 + waste), k = 25.4 for an inch job
Cabinet job cost estimate addons/cabinetcraft/lib/estimate.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Frame stock priced
The price per meter of face-frame stock scaled from a 38 × 19 mm board, and the meters needed.
rate = base × (width ÷ 38) × (thickness ÷ 19), in mm; meters = length ÷ 1000 × k × 1.1
Cabinet job cost estimate addons/cabinetcraft/lib/estimate.js64-bit- CadCraft
- BimCraft
- ModelCraft
- PartCraft
-
Countertop priced
The price of each countertop from its length and width.
amount = (length ÷ 1000 × k) × round(base × (width × k ÷ 600), 2 decimals)
Cabinet job cost estimate addons/cabinetcraft/lib/estimate.js64-bit- CadCraft
- BimCraft
- ModelCraft
- 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.