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 and their areas
Every closed region the boundary pieces make, with the signed area used to choose among them.
area = ½ Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)
Hatch boundaries and pattern lines hatch.js64-bit- CadCraft
-
Point inside a face
Whether the picked point, or an island, lies inside a face.
Hatch boundaries and pattern lines hatch.js64-bit- CadCraft
-
Pattern scale and angle
The pattern's line families at the hatch's scale, angle and origin.
k = scale ÷ (1 metric, 25.4 inch); origin = R(angle)·(x, y)·k; spacing and dashes × k
Hatch boundaries and pattern lines hatch.js64-bit- CadCraft
-
Pattern lines clipped to the boundary
The dashes of every pattern line that fall inside the hatch.
line k origin = O + k·(dx·u + dy·n); crossing: t = d₁ ÷ (d₁ − d₂) along an edge
Hatch boundaries and pattern lines hatch.js64-bit- CadCraft
-
Chaining pieces into paths
Joins line and arc pieces that follow one another into open or closed paths.
arc → bulge = tan((a1 − a0) ÷ 4); full circle → two half arcs with bulge 1
Drawing to laser paths laser-cad.js64-bit- CadCraft
-
A path through a block transform
A path placed by its block reference, keeping arcs where the transform allows.
Drawing to laser paths laser-cad.js64-bit- CadCraft
-
Drawing units to millimeters
The one scale factor that puts the drawing into millimeters.
k = millimeters per drawing unit, or 1 when the drawing has no units
Drawing to laser paths laser-cad.js64-bit- CadCraft
-
Picture placement
Where a picture lies on the laser bed and how large it is.
w = u_x × picture width; h = v_y × picture height, u and v the picture's axes through the transform
Drawing to laser paths laser-cad.js64-bit- CadCraft
-
Landing and text start
Where the landing ends and where the text starts.
end = last + dir·(landing length, 0); text = end + dir·(gap, 0)
Multileader geometry leader.js64-bit- CadCraft
-
Leader line, arrowhead and text
The polyline, the solid arrowhead and the text a multileader is drawn and exploded as.
u = (tip − next) ÷ |tip − next|; base = tip − u·a; corners = base ± (−u_y, u_x)·a ÷ 6; text top = landing y + h ÷ 2
Multileader geometry leader.js64-bit- CadCraft
-
abs, round, ceil and floor
The four functions an expression may call.
round(x) = floor(x + 0.5) for x ≥ 0, −floor(−x + 0.5) for x < 0; ceil(x) = ⌈x − 1e-9·max(1, |x|)⌉; floor(x) = ⌊x + 1e-9·max(1, |x|)⌋
Arithmetic on typed lengths lencalc.js64-bit- CadCraft
- ModelCraft
- MarkupCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Adding and subtracting
Sums and differences of lengths, left to right.
Arithmetic on typed lengths lencalc.js64-bit- CadCraft
- ModelCraft
- MarkupCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Multiplying and dividing
Products and quotients of a length and plain numbers, left to right.
Arithmetic on typed lengths lencalc.js64-bit- CadCraft
- ModelCraft
- MarkupCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
The answer
The final value and whether it is a length or a plain number.
Arithmetic on typed lengths lencalc.js64-bit- CadCraft
- ModelCraft
- MarkupCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Rounding of stored values
The two rounding helpers every stored number of an item goes through.
r4(v) = round(v × 10000) ÷ 10000; r2(v) = round(v × 100) ÷ 100
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
Block to millimeters
The transform from a block's own coordinates and units to the item's millimeters.
M = [mm, 0, 0, mm, −base.x·mm, −base.y·mm]; scale of a transform = √|det|; angle = r4(atan2(y, x) in degrees)
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
Lines, circles and arcs of a block
A block's lines, circles and arcs as plan entities in millimeters.
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
Nested block references
The transform of a block reference inside the block, with its rows and columns.
local = T(insert) · R(rotation) · S(sx, sy) · T(−base + column·spacing ÷ sx, row·spacing ÷ sy)
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
Mesh body from a block's 3D faces
The item's 3D body and height when the block holds 3D faces.
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
Arcs as points, 5° steps
The points that replace a circle or arc that cannot stay an arc.
n = max(8, ⌈sweep ÷ 5°⌉); point = c + r·(cos a, sin a)
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
Splines as points
The points that replace a block's spline in the item's plan.
de Boor recurrence at u = lo + (hi − lo)·s ÷ n, n = max(16, 8 × control points)
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
Arc points for bounds
The points of an arc used to find a plan's bounds.
n = max(4, ⌈sweep ÷ 10°⌉); point = c + r·(cos a, sin a)
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
Bounds of a plan
The box round an item's plan, from which its width and depth are taken.
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
Box body on a plan
A box body standing on the plan's bounds with a given height.
w = max x − min x; d = max y − min y; each of x, y, z, w, d, h rounded to 4 decimals
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
Item from a mesh file
A mesh file's triangles as an item body in millimeters, with its footprint and sizes.
p = file point × unit in mm; Y-up: (x, y, z) → (x, −z, y); stored = r4(p − (center x, max y, min z))
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
STL corners
The corner points of an STL file's triangles.
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
glTF accessor values
The numbers of a glTF position or index accessor.
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
glTF node transforms
The matrix that places each glTF node's mesh.
M = T · R(q) · S, R from the quaternion (qx, qy, qz, qw)
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
Convex hull footprint
The outline round a mesh item's points, used as its plan.
monotone chain; turn = (a − o) × (b − o), popped when ≤ 0
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
Box of a body
The box a body fills: a box body itself, or the extent of a mesh body.
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
Box item from width, depth and height
The rectangle plan and box body of an item given only by its sizes.
x from −w ÷ 2 to +w ÷ 2; y from −d to 0; label height = min(0.18 d, 150), reduced to fit 90% of w
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
Sizes from attributes
Width, depth and height read from a block's attributes.
Library item geometry from blocks, meshes and tables libitem.js64-bit- CadCraft
- BimCraft
-
Millimeters per unit
The table of unit factors.
in 25.4; ft 304.8; yd 914.4; mi 1 609 344; mil 0.0254; µm 0.001
Lengths and units for Library items libitem.jsExact- CadCraft
- BimCraft
-
Length from text
A typed or stored length in millimeters.
with a unit: n × factor; feet and inches: (feet × 12 + inches + a ÷ b) × 25.4; bare number: n × mm per unit
Lengths and units for Library items libitem.js64-bit- CadCraft
- BimCraft
-
Drawing units
The millimeters per drawing unit of a DWG or DXF file.
Lengths and units for Library items libitem.jsExact- CadCraft
- BimCraft
-
Pipe size in eighths of an inch
A decimal inch size written as a fraction, such as 1 1/2".
eighths = round((n − ⌊n⌋) × 8)
Lengths and units for Library items libitem.js64-bit- CadCraft
- BimCraft
-
Size label on the preview
The overall width and depth printed on an item's preview picture.
millimeters: round(mm); inches: round(mm ÷ 25.4 × 8) eighths
Lengths and units for Library items libitem.js64-bit- CadCraft
- BimCraft
-
Millimeters to drawing units
The factor that puts an item's millimeters into the drawing's units.
k = 1 ÷ (mm per drawing unit), or 1 when the drawing has no units
Library item placed as a block libplace.js64-bit- CadCraft
-
Plan entities in drawing units
Each line, circle, arc, polyline, ellipse, text, point and hatch of the item as a drawing object.
length × k; angle in degrees × π ÷ 180, reduced to [0, 2π)
Library item placed as a block libplace.js64-bit- CadCraft
-
Size attributes
The width, depth, height and weight written as attributes on the block.
Library item placed as a block libplace.js64-bit- CadCraft
-
Count and quantity of each item
How many times each Library item is placed and the total of their quantities, for the credits and schedule.
placed = number of references; quantity = Σ parseFloat(quantity attribute), 1 when not above 0
Library item placed as a block libplace.js64-bit- CadCraft
-
Pattern in drawing units
The dash and gap lengths of a linetype for this drawing.
metric drawing: inch pattern × 25.4
Linetype dashes linetypes.js64-bit- CadCraft
-
Dashes along lines and arcs
The pieces of each line or arc that are drawn.
piece from fraction s ÷ length to (s + step) ÷ length; arc length = r × sweep
Linetype dashes linetypes.js64-bit- CadCraft
-
Warp plan for a picture or tile
How finely a map image is cut into patches so that it lands in the right place on screen.
tolerance = 0.25 ÷ zoom project units, rounded to a half power of 2
Map layers under the drawing maplayers.js32-bit, display only- CadCraft
- BimCraft
-
Drawing the patches
Each patch of a map image drawn on the canvas.
Map layers under the drawing maplayers.js32-bit, display only- CadCraft
- BimCraft
-
Local placement record
The scale, rotation and point pair that tie drawing coordinates to grid coordinates.
scale = m per drawing unit ÷ m per grid unit; from = (x, y); to = (e, n)
Drawing placed on a map grid maplayers.js64-bit- CadCraft
- BimCraft
-
Meters per drawing unit
The table that converts drawing units to the 3D model's meters.
inch 0.0254; foot 0.3048; yard 0.9144; mile 1609.344; no unit 0.001
3D solids, faces and units in a drawing model3d.jsExact- CadCraft
-
Outline of a closed 2D object
The ring of points a solid is extruded from, and its area.
circle: 48 points at radius r; arc: steps of at most 7.5°; area = ½ |Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)|
3D solids, faces and units in a drawing model3d.js64-bit- CadCraft
-
Extruded solid
A solid made by pushing a ring up or down by a height.
local ring = ring − (min x, min y); placed at (min x, min y, z₀)
3D solids, faces and units in a drawing model3d.js64-bit- CadCraft
-
Cylinder
A cylinder from a center, radius and height.
3D solids, faces and units in a drawing model3d.js64-bit- CadCraft
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.