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
-
Linear unit of a .prj
Decides whether a projection is in meters, international feet or US survey feet.
|k − 1| < 1e-12 → m; |k − 0.3048| < 1e-10 → ft; |k − 1200 ÷ 3937| < 1e-10 → ftUS
Coordinate reference systems crs.js64-bit- CadCraft
- BimCraft
- CivilCraft
-
Extent of a grid shift file
The west, south, east and north limits, in degrees, of the area a loaded grid shift file covers.
east = −λ_ll × 180 ÷ π; west = −(λ_ll + (n_λ − 1) × Δλ) × 180 ÷ π; north = (φ_ll + (n_φ − 1) × Δφ) × 180 ÷ π
Coordinate reference systems crs.js64-bit- CadCraft
- BimCraft
- CivilCraft
-
UTM zone to EPSG code
The EPSG number of a UTM zone typed as text such as UTM 33N.
WGS 84: 32600 + zone (north), 32700 + zone (south); NAD83: 26900 + zone; ETRS89: 25800 + zone; GDA94: 28300 + zone; GDA2020: 7800 + zone
Coordinate reference systems crs-pick-shared.jsExact- CadCraft
- BimCraft
- CivilCraft
-
Linear unit of a typed definition
Decides whether a typed projection definition is in meters, international feet, US survey feet or degrees.
|k − 1| < 1e-12 → m; |k − 0.3048| < 1e-10 → ft; |k − 1200 ÷ 3937| < 1e-10 → ftUS
Coordinate reference systems crs-pick-shared.js64-bit- CadCraft
- BimCraft
- CivilCraft
-
Probe points for a typed definition
Three longitude and latitude points inside the definition's zone, used to compare it with catalog systems.
Coordinate reference systems crs-pick-shared.js64-bit- CadCraft
- BimCraft
- CivilCraft
-
Matching a typed definition to the catalog
Finds the catalog systems that give the same easting and northing as a typed definition.
same projection family; |a − a′| ≤ 1e-3; |e² − e′²| ≤ 1e-9; distance at each of 3 probe points < 1e-3
Coordinate reference systems crs-pick-shared.js64-bit- CadCraft
- BimCraft
- CivilCraft
-
Round-trip check of a typed definition
Refuses a typed projection that does not return its own probe point.
|inverse(forward(λ, φ)) − (λ, φ)| < 1e-6 degrees in each of λ and φ
Coordinate reference systems crs-pick-shared.js64-bit- CadCraft
- BimCraft
- CivilCraft
-
Do two systems give the same coordinates
Says whether two systems give the same easting and northing.
same unit and distance at each of 3 probe points < 1e-3
Coordinate reference systems crs-pick-shared.js64-bit- CadCraft
- BimCraft
- CivilCraft
-
Block size from its label
The width and height of a diagram block.
w = longest line × th × 0.62 + 3 × th; h = (lines × 1.3 + 1.7) × th; diamond: w × 1.5, h × 1.6; minimum width 8 × th (diamond 10 × th)
Diagram layout into drawing objects diagram.js64-bit- CadCraft
-
Symbol scale in a block
The factor that fits a symbol drawing into a box of six text heights.
k = 6 × th ÷ max(w, 1.4 × h)
Diagram layout into drawing objects diagram.js64-bit- CadCraft
-
Symbol geometry scaled and moved
Scales a symbol's lines, circles, arcs, polylines, hatches and text by k and moves them to the block.
x′ = x × k + dx; y′ = y × k + dy; r′ = r × k
Diagram layout into drawing objects diagram.js64-bit- CadCraft
-
Block coordinates
The x and y of every block in a layered diagram.
x = previous edge + w ÷ 2, gap 2.5 × th; y = Σ (layer height + 4 × th); then x → mean of neighbors' x, kept in order with the gap
Diagram layout into drawing objects diagram.js64-bit- CadCraft
-
Sequence diagram positions
The x of each lifeline and the y of each message row in a sequence diagram.
gap ≥ 2.5 × th and ≥ (label length × th × 0.8 × 0.62 + 2 × th) ÷ lifelines crossed; row = 3.4 × th; top = box height + 2.6 × th
Diagram layout into drawing objects diagram.js64-bit- CadCraft
-
Layout to drawing coordinates
Places the laid-out diagram at a point in the drawing, turning y from downward to upward.
X = x + px − minX; Y = y − (py − minY)
Diagram layout into drawing objects diagram.js64-bit- CadCraft
-
Arrowhead triangle
The three corners of a connector's filled arrowhead.
u = (to − from) ÷ |to − from|; corners: to, to − u × s ± n × 0.35 × s
Diagram layout into drawing objects diagram.js64-bit- CadCraft
-
Measured value
The length, radius, diameter or angle a dimension reports.
linear = |(p₂ − p₁) · (cos r, sin r)|; aligned = |p₂ − p₁|; radius = |p₁ − c|; diameter = 2 × |p₁ − c|; angular = sweep
Dimension measurement and geometry dims.js64-bit- CadCraft
-
Sector of an angular dimension
The start angle, end angle and counterclockwise sweep an angular dimension measures.
a₁ = atan2(p₁ − c); a₂ = atan2(p₂ − c); sweep = (end − start) mod 2π
Dimension measurement and geometry dims.js64-bit- CadCraft
-
Ends of the dimension line
Where the two extension lines meet the dimension line, square or at an obliquing angle.
square: q = loc + u × ((p − loc) · u); oblique: q = p + d × ((loc − p) · n) ÷ (d · n)
Dimension measurement and geometry dims.js64-bit- CadCraft
-
Angular dimension between two lines
The vertex where two lines cross and a point on each leg bounding the sector that holds the text point.
den = d₁ × d₂; t = ((l₂ − l₁) × d₂) ÷ den; c = l₁ + d₁ × t
Dimension measurement and geometry dims.js64-bit- CadCraft
-
Linear and aligned dimension parts
The extension lines, dimension line, arrowheads and text point of a linear or aligned dimension.
extension line: from p + exo to q + exe; arrows inside when length ≥ 2 × asz; text at the middle, offset by gap
Dimension measurement and geometry dims.js64-bit- CadCraft
-
Angular dimension parts
The arc, extension lines, arrowheads and text point of an angular dimension.
R = |loc − c|; arc from a₀ to a₁ at R; arrows outside when R × sweep < 2 × asz; text at c + (R + gap) at a₀ + sweep ÷ 2
Dimension measurement and geometry dims.js64-bit- CadCraft
-
Radius and diameter dimension parts
The center mark, leader or dimension line, arrowheads and text point of a radius or diameter dimension.
r = |p₁ − c|; P = c + r × (cos u, sin u); Q = c − r × (cos u, sin u); center mark half-length = asz ÷ 2
Dimension measurement and geometry dims.js64-bit- CadCraft
-
Closed arrowhead
The three corners of the default filled arrowhead.
base = tip − asz along the arrow; corners = base ± asz ÷ 6 across
Dimension measurement and geometry dims.js64-bit- CadCraft
-
Text for a measurement
The main text, alternate-unit text and tolerance text a dimension style writes for a measured value.
m = round(v × |lfac|, rnd); alternate = round(m × altf, altrnd); limits: upper = base + tp, lower = base − tm
Dimension text: units, rounding and tolerances dimstyle.js64-bit- CadCraft
-
Decimal number text
Writes a value with a fixed number of decimal places and the style's zero suppression.
d = clamp(round(dec), 0, 8); |v| < 0.5 × 10⁻ᵈ → 0; text = v to d places
Dimension text: units, rounding and tolerances dimstyle.js64-bit- CadCraft
-
Round-off to a multiple
Rounds a value to the nearest multiple of the style's round-off.
r > 0: Math.round(v ÷ r) × r; else v
Dimension text: units, rounding and tolerances dimstyle.js64-bit- CadCraft
-
Length text
Writes a length as a decimal number or, for other unit formats, through the shared length formatter.
Dimension text: units, rounding and tolerances dimstyle.js64-bit- CadCraft
-
Angle text
Writes an angle in decimal degrees, degrees-minutes-seconds, grads or radians.
degrees = radians ÷ (π ÷ 180); minutes = (degrees − ⌊degrees⌋) × 60; seconds = (minutes − ⌊minutes⌋) × 60; grads = degrees ÷ 0.9
Dimension text: units, rounding and tolerances dimstyle.js64-bit- CadCraft
-
Millimeters in each text unit
The size of the units a dimension can write its value in.
mm = 1; cm = 10; m = 1000; km = 1 000 000
Dimension text: units, rounding and tolerances dimstyle.jsExact- CadCraft
-
Measurement scale for a text unit
Sets the scale that makes a dimension write its value in mm, cm, m or km.
lfac = mmPerUnit ÷ mm in the unit
Dimension text: units, rounding and tolerances dimstyle.js64-bit- CadCraft
-
Which text unit a style writes
Recognizes a style's scale and suffix as mm, cm, m or km, as drawn, or custom.
|lfac − mmPerUnit ÷ unit| ≤ 1e-9 × max(1, lfac); as drawn: |lfac − 1| < 1e-12
Dimension text: units, rounding and tolerances dimstyle.js64-bit- CadCraft
-
Millimeters in one drawing unit
The size of a drawing unit, or of a sheet's paper unit, in millimeters.
paper in inches: 25.4; paper in mm: 1; model: mmPerDrawingUnit; unitless: 1 (assumed)
Dimension text: units, rounding and tolerances dimstyle.js64-bit- CadCraft
-
Refit after the drawing units change
Gives dimensions that write in mm to km a new scale when the drawing's unit changes.
lfac′ = new mm per unit ÷ mm in the unit
Dimension text: units, rounding and tolerances dimstyle.js64-bit- CadCraft
-
Arrowhead shapes
The lines, circle or filled outline of each arrowhead style at a tip, direction and size.
half-width = size ÷ 6; open 30°: tan(15°) × size; dot radius = size ÷ 4 (small: size ÷ 8), drawn with 16 sides; tick at 45°, half-length size ÷ 2
Dimension text: units, rounding and tolerances dimstyle.js64-bit- CadCraft
-
Number rounded for comparison
The text a number is compared by: its value on a grid of 0.0001.
Math.round(v ÷ 0.0001) × 0.0001, written with at most 4 decimals
Drawing compare drawing-compare.js64-bit- CadCraft
-
Center and size of an object
The middle of an object's bounding box and the length of its diagonal, used to pair objects.
cx = (minX + maxX) ÷ 2; cy = (minY + maxY) ÷ 2; d = √((maxX − minX)² + (maxY − minY)²)
Drawing compare drawing-compare.js64-bit- CadCraft
-
Pairing by distance
Pairs each leftover object with the nearest object of the other version that is close enough.
d = |center_a − center_b|; candidate when d ≤ max(size_a, size_b) + 1e-9; nearest first
Drawing compare drawing-compare.js64-bit- CadCraft
-
Moved or reshaped
Says whether a changed object only moved: every x shifted by one amount and every y by another.
|Δxᵢ − Δx₀| ≤ 1e-3 and |Δyᵢ − Δy₀| ≤ 1e-3 for every coordinate; other numbers equal on the 0.0001 grid
Drawing compare drawing-compare.js64-bit- CadCraft
-
Dimension from its defining points
Rebuilds a file's dimension as an editable dimension when its points give the measurement the file states.
accept when |measured − file| ≤ 1e-6 × max(1, file); diameter center = (defPoint + chord point) ÷ 2
DWG import: objects from the file's model dwg-import.js64-bit- CadCraft
-
Hatch boundary to polygon rings
Turns a hatch's boundary paths (polylines with bulges, lines, arcs, ellipses, splines) into rings of points.
arc: n = max(4, ⌈32 × sweep ÷ 2π⌉) chords; ellipse: n = max(8, ⌈48 × sweep ÷ 2π⌉); p = c + r × (cos a, sin a)
DWG import: objects from the file's model dwg-import.js64-bit- CadCraft
-
Bulge arc to points
The points along a polyline arc segment given by its two ends and its bulge.
θ = 4 × atan(b); r = c ÷ (2 × sin(θ ÷ 2)); center = midpoint + normal × r × cos(θ ÷ 2); n = max(2, ⌈16 × |θ| ÷ π⌉)
DWG import: objects from the file's model dwg-import.js64-bit- CadCraft
-
Spline edge to points
Points along a spline edge of a hatch boundary.
n = min(400, max(16, 8 × control points)); de Boor: d_j = (1 − a) × d_{j−1} + a × d_j, a = (u − k_i) ÷ (k_{i+p−r+1} − k_i); point = (x, y) ÷ w
DWG import: objects from the file's model dwg-import.js64-bit- CadCraft
-
Picture and wipeout frame
The corners of an image's frame or clip boundary in drawing coordinates.
W(q) = p + (q_x + 0.5) × u + (h − 0.5 − q_y) × v
DWG import: objects from the file's model dwg-import.js64-bit- CadCraft
-
Block array positions
The insertion point of each copy of a block placed as a rows-by-columns array.
(x, y) = insert + R(rot) × (k × column spacing, r × row spacing)
DWG import: objects from the file's model dwg-import.js64-bit- CadCraft
-
Viewport scale
The scale of a sheet viewport and the model point at its center.
s = viewport height ÷ view height (1 when the view height is not above 0)
DWG import: objects from the file's model dwg-import.js64-bit- CadCraft
-
Hatch pattern lines
The file's own pattern lines: angle in degrees, base point, and offset along and across each line.
angle° = angle × 180 ÷ π; dx = o_x cos a + o_y sin a; dy = −o_x sin a + o_y cos a
DWG import: objects from the file's model dwg-import.js64-bit- CadCraft
-
Lineweight in millimeters
Converts a lineweight from hundredths of a millimeter to millimeters.
mm = v ÷ 100 for v ≥ 0; −2 and −3 kept as codes
DWG import: objects from the file's model dwg-import.js64-bit- CadCraft
-
Multi-line text rotation and oblique angle
The rotation of multi-line text from its direction vector, and its oblique angle from the text's format code.
rot = atan2(xAxis_y, xAxis_x); oblique = degrees in the \Q code × π ÷ 180
DWG import: objects from the file's model dwg-import.js64-bit- CadCraft
-
Construction line direction
The unit direction of an infinite line or ray.
n = √(d_x² + d_y²); direction = (d_x ÷ n, d_y ÷ n)
DWG import: objects from the file's model dwg-import.js64-bit- CadCraft
-
Dimension style numbers
Reads a dimension style's variables and brings the decimal places and flags into range.
scale ≤ 0 → 1; dec, adec, tad, zin → clamp(round(value), 0, 8)
DWG import: objects from the file's model dwg-import.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.