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.

  • 6,917 calculations in 1,248 source files
  • 143 exact
  • 6,286 in 64-bit
  • 335 with a 32-bit step
  • Last reviewed

Calculations

  • Volume printed after a 3D command

    The total volume of the solids a command just made, in drawing units cubed.

    V = Σ volumeᵢ ÷ (k × k × k)

    3D solid commands: sizes, paths and reported volume commands3d.js
    • CadCraft
    64-bit
  • Number text in 3D command messages

    How heights, radii, angles and volumes are written on the command line.

    |n| < 1e-10 → 0; otherwise n rounded to 4 decimals

    3D solid commands: sizes, paths and reported volume commands3d.js
    • CadCraft
    64-bit
  • Sweep path from a 2D object

    The points a profile is swept along, taken from a line, polyline, arc, circle or ellipse.

    n = max(2, ⌈sweep ÷ (π ÷ 24)⌉); pᵢ = c + r × (cos aᵢ, sin aᵢ), aᵢ = a₀ ± sweep × i ÷ n

    3D solid commands: sizes, paths and reported volume commands3d.js
    • CadCraft
    64-bit
  • Extrude: outline, height and taper to model units

    Converts the picked outline and the typed height and taper angle into the numbers the solid is made from.

    ring = (x × k, y × k); height = h × k; taper = degrees × π ÷ 180

    3D solid commands: sizes, paths and reported volume commands3d.js
    • CadCraft
    64-bit
  • Revolve angle

    The angle a profile is turned through; no angle means a full turn.

    θ = 2π if |angle| < 1e-9, else angle

    3D solid commands: sizes, paths and reported volume commands3d.js
    • CadCraft
    64-bit
  • Meters per unit

    The length of a meter, an international foot and a US survey foot in meters.

    m = 1; ft = 0.3048; ftUS = 1200 ÷ 3937

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    Exact
  • Local system to grid and back

    Moves a point between project (ground or assumed) coordinates and grid coordinates.

    grid = to + k × R(θ) × (p − from); p = from + R(θ)ᵀ × (grid − to) ÷ k

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Project point to longitude and latitude and back

    The longitude and latitude (WGS 84) of a project point, and the project point of a longitude and latitude.

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Grid scale factor, convergence and elevation factor

    At a project point: the grid scale factor, the meridian convergence in degrees, the elevation factor and the combined factor.

    k_N = |p(φ+d) − p(φ−d)| ÷ (2 M d); k_E = |p(λ+d) − p(λ−d)| ÷ (2 N cos φ d); k = (k_N + k_E) ÷ 2; γ = −atan2(Δx, Δy); elevation = R ÷ (R + h), R = √(M N)

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Local system from two control points

    The scale and rotation that carry two points known in both local and grid coordinates onto each other.

    scale = |B − A| ÷ |b − a|; rotation = atan2(grid) − atan2(local), in degrees, brought into −180 to 180

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Ground coordinates about a base point

    A local system that scales by a combined factor about one base point, with no rotation.

    scale = combined; rotation = 0; from = to = base

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Any system to any system

    Converts a coordinate pair from one system's definition to another's.

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Matching a .prj to a catalog system

    Decides whether the projection in a .prj file is one of the catalog's systems, and if so uses the catalog's definition.

    |a − a′| < 1e-3; |e² − e′²| < 1e-9; distance at each of 3 probe points < 1e-3 (1e-9 for geographic)

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Probe points for matching

    Three longitude and latitude points inside a projection's zone, used to compare two definitions.

    (λ₀, φ), (λ₀ + 0.5°, φ + 0.5°), (λ₀ − 0.5°, φ + 0.25°)

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • 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.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • 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.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • 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.js
    • CadCraft
    • BimCraft
    • CivilCraft
    Exact
  • 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.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • 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.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • 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.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • 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.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • 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.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    Exact
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit
  • 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.js
    • CadCraft
    64-bit

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.