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
-
Numbers written to the PDF and SVG
Turns a coordinate, width or size into the text that goes into the file.
text = v.toFixed(4), trailing zeros dropped; |v| < 0.00005 → 0
Plotting: sheet scale, PDF, SVG and PNG output plot.js64-bit- CadCraft
-
Arcs as cubic Béziers
The Bézier pieces that draw an arc in the PDF.
n = ⌈|sweep| ÷ 90°⌉; d = sweep ÷ n; k = 4⁄3 · tan(d ÷ 4); handles at r·k along the tangents
Plotting: sheet scale, PDF, SVG and PNG output plot.js64-bit- CadCraft
-
Lines and arcs in the page
Writes each line and arc of a stroke group as PDF path operators.
arc start = c + r(cos a, sin a)
Plotting: sheet scale, PDF, SVG and PNG output plot.js64-bit- CadCraft
-
Text placement in the PDF
The text matrix of each line of text: size, width factor, rotation, lean and position.
size = h × FONT_EM; width = advance ÷ 1000 × size × wf; lean = size × tan(oblique)
Plotting: sheet scale, PDF, SVG and PNG output plot.js64-bit- CadCraft
-
Page size in points
The PDF page's width and height from the sheet's millimeters.
pt = mm × 72 ÷ 25.4, written with 4 decimals
Plotting: sheet scale, PDF, SVG and PNG output plot.js64-bit- CadCraft
-
Lines and arcs in the SVG
Writes each line and arc of a stroke group as SVG path data.
arc pieces of at most 90°: A r r 0 0 flag x y
Plotting: sheet scale, PDF, SVG and PNG output plot.js64-bit- CadCraft
-
Paper size from a printer's paper name
The size in millimeters of a named paper such as A3, Letter or 24 x 36 in.
A-series: start 841 × 1189, each step (w, h) → (⌊h ÷ 2⌋, w); inches × 25.4
Plotting: sheet scale, PDF, SVG and PNG output plot.js64-bit- CadCraft
-
Matching a sheet to a printer paper
Finds the printer paper that is the sheet's size.
|short − a| ≤ 2 mm and |long − b| ≤ 2 mm
Plotting: sheet scale, PDF, SVG and PNG output plot.js64-bit- CadCraft
-
PNG size in pixels
The pixel width and height of a sheet at a resolution, held under what a canvas can make.
px = round(mm ÷ 25.4 × dpi), at least 1; while too big: dpi = ⌊dpi × 0.9⌋
Plotting: sheet scale, PDF, SVG and PNG output plot.js64-bit- CadCraft
-
Plot extents of the model
The box round everything the model would plot.
Plotting: sheet scale, PDF, SVG and PNG output plot.js64-bit- CadCraft
-
Zero-size test
Says whether a line has no length or a circle or arc no radius.
line: |p₂ − p₁| ≤ 1e-9; circle or arc: r ≤ 1e-9
Drawing audit: zero-size and duplicate objects problems-cadcraft.js64-bit- CadCraft
-
Duplicate test
A text key that two objects share only when they are the same shape on the same layer.
Drawing audit: zero-size and duplicate objects problems-cadcraft.jsExact- CadCraft
-
Unit sizes
Builds each unit's row: its fraction of the base unit and the factor used for quick conversion.
factor = n ÷ d (× π for degrees and gons)
Unit table: reading and writing values unit-table.js Every appExact -
Numbers and fractions
Reads 6, 6.5, 6 1/2, 6-1/2 or 1/2 as a number.
whole + numerator ÷ denominator
Unit table: reading and writing values unit-table.js Every app64-bit -
Feet and inches
Reads 12'6", 12'-6 1/2" or 6" as inches.
inches = feet × 12 + inches
Unit table: reading and writing values unit-table.js Every app64-bit -
Degrees, minutes and seconds
Reads 45°30'15" or 45d30m15s as degrees.
degrees + minutes ÷ 60 + seconds ÷ 3600
Unit table: reading and writing values unit-table.js Every app64-bit -
Slopes
Reads 2%, 3H:1V, 1:3 or 6/12 as a grade (rise over run).
percent ÷ 100; H:V → V ÷ H; rise:run → rise ÷ run
Unit table: reading and writing values unit-table.js Every app64-bit -
Writing feet and inches
Writes a length as feet, inches and a fraction of an inch.
n = round(|inches| × den); feet = ⌊n ÷ 12den⌋; inches = ⌊rest ÷ den⌋; fraction = rest ÷ den, reduced
Unit table: reading and writing values unit-table.js Every app64-bit -
Writing degrees, minutes and seconds
Writes an angle as degrees, minutes and seconds.
t = round(|degrees| × 3600 × 10^dec); split by 3600 and 60
Unit table: reading and writing values unit-table.js Every app64-bit -
Writing decimals
Writes a number with a fixed count of decimals.
text = v.toFixed(dec)
Unit table: reading and writing values unit-table.js Every app64-bit -
Writing a length
A length as text in one of the five formats.
engineering: r = round(|v| × 10^p) ÷ 10^p; feet = ⌊r ÷ 12 + 1e-12⌋; architectural: whole inches and a fraction of 1⁄2^p
Lengths as text: formats and typed lengths units.js64-bit- CadCraft
-
Whole part and fraction
Splits a value into a whole number and a reduced fraction of a power of two.
n = round(|v| × den); whole = ⌊n ÷ den⌋; numerator = n − whole × den
Lengths as text: formats and typed lengths units.js64-bit- CadCraft
-
Writing decimals
A number with up to prec decimals, trailing zeros dropped.
|v| < 0.5 × 10^−prec → 0; else v.toFixed(prec)
Lengths as text: formats and typed lengths units.js64-bit- CadCraft
-
Writing an area
An area as text: square drawing units, or square inches and square feet in the feet-and-inches formats.
sq ft = sq in ÷ 144
Lengths as text: formats and typed lengths units.js64-bit- CadCraft
-
Numbers and fractions typed
Reads 6, 6.5, 6-1/2, 6 1/2 or 1/2 as a number.
whole + numerator ÷ denominator
Lengths as text: formats and typed lengths units.js64-bit- CadCraft
-
One typed length
Reads a single length such as 12'6" or 6-1/2 into drawing units.
feet × 12 + inches, with the sign applied last
Lengths as text: formats and typed lengths units.js64-bit- CadCraft
-
Millimeters per drawing unit
The size of one drawing unit in millimeters, from the drawing's units.
inch 25.4; foot 304.8; yard 914.4; mile 1 609 344; micron 0.001
Lengths as text: formats and typed lengths units.jsExact- CadCraft
-
A length typed with a unit
Converts a number with a unit mark, such as 450mm or 6in, into drawing units.
mm, cm, m, in, ft: value × mm per typed unit ÷ mm per drawing unit; other marks: parseTo into the drawing's unit
Lengths as text: formats and typed lengths units.js64-bit- CadCraft
-
Writing an angle
An angle in degrees as the drawing's angle format writes it.
decimal: deg.toFixed(4)
Lengths as text: formats and typed lengths units.js64-bit- CadCraft
-
Lengths with units inside an entry
Replaces 900mm, 2ft or 3'6" in the typed text by the same length in drawing units.
mm = feet × 304.8 + inches × 25.4, or value × mm per unit; text = (mm ÷ mm per drawing unit) to 12 significant digits
Values typed in the Properties panel propexpr.js64-bit- CadCraft
-
Degrees, minutes and seconds inside an expression
Replaces 45°30'15" in an angle expression by decimal degrees.
degrees + minutes ÷ 60 + seconds ÷ 3600, written with 12 significant digits
Values typed in the Properties panel propexpr.js64-bit- CadCraft
-
Full-precision text of a value
The text a number field shows while it is edited.
v.toPrecision(12)
Values typed in the Properties panel propexpr.js64-bit- CadCraft
-
Millimeters per drawing unit
The size of one drawing unit, or of the sheet's paper unit, in millimeters.
inch 25.4; foot 304.8; yard 914.4; mile 1 609 344
Values typed in the Properties panel propexpr.jsExact- CadCraft
-
Limits on a typed value
Checks a result against the field's kind and limits.
whole number: |v − round(v)| ≤ 1e-9; v ≥ min − 1e-12; v ≤ max + 1e-12
Values typed in the Properties panel propexpr.js64-bit- CadCraft
-
Angles typed in radians, grads or degrees-minutes-seconds
Reads 0.5r, 100g or 45°30'15" as degrees.
radians × (180 ÷ π); grads × 0.9; d + m ÷ 60 + s ÷ 3600
Values typed in the Properties panel propexpr.js64-bit- CadCraft
-
Length, area and perimeter of an object
The measures the panel shows for one object.
Properties panel: measures and geometry edits propdefs.js64-bit- CadCraft
-
Centroid of a closed polyline
The point a closed polyline is scaled about when its area is typed.
a = Σ (xᵢyⱼ − xⱼyᵢ); c = Σ (pᵢ + pⱼ)(xᵢyⱼ − xⱼyᵢ) ÷ 3a
Properties panel: measures and geometry edits propdefs.js64-bit- CadCraft
-
Scaling a polyline to a typed area
Resizes a closed polyline about its centroid so its area becomes the value typed.
k = √(A ÷ A₀); p′ = c + (p − c)·k
Properties panel: measures and geometry edits propdefs.js64-bit- CadCraft
-
Line: length and angle
Shows a line's length, angle and deltas, and moves its end point when length or angle is typed.
L = |p₂ − p₁|; new end = p₁ + L·(cos a, sin a)
Properties panel: measures and geometry edits propdefs.js64-bit- CadCraft
-
Circle: diameter, circumference and area
Shows a circle's diameter, circumference and area, and sets the radius when one of them is typed.
d = 2r; C = 2πr; A = πr²; r = d ÷ 2, C ÷ 2π, √(A ÷ π)
Properties panel: measures and geometry edits propdefs.js64-bit- CadCraft
-
Arc: sweep, length, chord and segment area
Shows an arc's angles, sweep, length, chord and segment area, and changes the arc when one is typed.
θ = (a₁ − a₀) mod 2π; length = rθ; chord = 2r·sin(θ ÷ 2); area = r²(θ − sin θ) ÷ 2
Properties panel: measures and geometry edits propdefs.js64-bit- CadCraft
-
Ellipse: axes and angles
Shows an ellipse's major and minor axis, ratio, axis angle and start and end angles, and changes them when typed.
major = |m|; minor = |m| × ratio; ratio = minor ÷ major
Properties panel: measures and geometry edits propdefs.js64-bit- CadCraft
-
Ellipse parameter and true angle
Converts between an ellipse's stored parameter and the angle seen from its center.
angle = atan2(ratio·sin t, cos t); t = atan2(sin a ÷ ratio, cos a)
Properties panel: measures and geometry edits propdefs.js64-bit- CadCraft
-
Do several objects share a value
Decides whether a field shows one value or 'varies' for a selection.
|a − b| ≤ 1e-9 × max(1, |a|, |b|)
Properties panel: measures and geometry edits propdefs.js64-bit- CadCraft
-
Text held by a number field
Chooses whether a field holds the formatted text (12'-6") or the plain number.
formatted text kept when |read(text) − value| ≤ 1e-9 × max(1, |value|)
Properties panel: measures and geometry edits props.js64-bit- CadCraft
-
Rigid fit from point pairs
The rotation and shift that best take the picked points of one scan onto their targets, with the error left at each pair.
R from the top eigenvector (a quaternion) of Horn's 4 × 4 matrix; t = c_dst − R·c_src; rms = √(Σ rᵢ² ÷ n)
Scan registration register.js64-bit- CadCraft
- BimCraft
-
Eigenvalues of a symmetric matrix
Eigenvalues and eigenvectors of the 3 × 3 and 4 × 4 symmetric matrices the fit and the normals use.
Jacobi rotations: θ = (a_qq − a_pp) ÷ 2a_pq; t = sign(θ) ÷ (|θ| + √(θ² + 1))
Scan registration register.js64-bit- CadCraft
- BimCraft
-
Combining transforms
The product of two 4 × 4 transforms, used to add each iteration's step to the running transform.
o = a · b, each entry a sum of four products
Scan registration register.js64-bit- CadCraft
- BimCraft
-
Inverse of a rigid transform
The transform that undoes a rotation and shift.
R⁻¹ = Rᵀ; t′ = −Rᵀ·t
Scan registration register.js64-bit- CadCraft
- BimCraft
-
Transform in shifted coordinates
Rewrites a transform for coordinates measured from the working origin, and back.
t_local = t + R·o − o; back: t = t_local − R·o + o
Scan registration register.js64-bit- CadCraft
- BimCraft
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.