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

  • Render size in pixels

    The pixel width and height for an area given in points at a resolution, lowered so neither side passes the cap.

    d = dpi × min(1, maxPx ÷ (longer side × dpi ÷ 72)); w = round(wPt × d ÷ 72); h = round(hPt × d ÷ 72)

    Size of a copied area areaclip.js
    • CadCraft
    • BimCraft
    • MarkupCraft
    • DetailCraft
    64-bit
  • Scale and turn from two points

    The scale, the angle and the point mapping that carry two points on the picture onto the two points where they belong.

    scale = |b₂ − b₁| ÷ |a₂ − a₁|; angle = atan2(b₂ − b₁) − atan2(a₂ − a₁); map(p) = b₁ + scale · R(angle) · (p − a₁)

    Size of a copied area areaclip.js
    • CadCraft
    • BimCraft
    • MarkupCraft
    • DetailCraft
    64-bit
  • Box round a turned picture

    The width and height of the upright box round a picture turned by an angle.

    w′ = w·|cos θ| + h·|sin θ|; h′ = w·|sin θ| + h·|cos θ|

    Size of a copied area areaclip.js
    • CadCraft
    • BimCraft
    • MarkupCraft
    • DetailCraft
    64-bit
  • Outline of an elliptical area

    The points of the ellipse that fits a box, used as the outline of a round copied area.

    pᵢ = (cx + rx·cos(2π·i ÷ n), cy + ry·sin(2π·i ÷ n)), n = 96

    Size of a copied area areaclip.js
    • CadCraft
    • BimCraft
    • MarkupCraft
    • DetailCraft
    64-bit
  • Unit factor and tolerance

    The factor between drawing units and the file's units, and the tolerance the comparison uses.

    factor = mm per unit ÷ 1000 (meters), ÷ 304.8 (feet), or 1; default tol = 10 ÷ mm per unit

    As-built points compared with the drawing asbuilt.js
    • CadCraft
    64-bit
  • Comparison and conversion back to the drawing

    Compares the two point lists in the file's units and brings as-built points back into drawing coordinates.

    compare with tol × factor; drawn point = file point ÷ factor

    As-built points compared with the drawing asbuilt.js
    • CadCraft
    64-bit
  • Marks and labels in the drawing

    A point at each as-built shot, a line from the design point when it is out of tolerance, and a label with the distance.

    label = (dh ÷ factor).toFixed(min(4, max(0, ⌈−log₁₀ tol⌉))); text height = max(1.5 × tol, 0.5 × current text height)

    As-built points compared with the drawing asbuilt.js
    • CadCraft
    64-bit
  • Same object within a tolerance

    Whether two objects are the same shape on the same layer, apart from their ids.

    Drawing autocomplete autocomplete.js
    • CadCraft
    64-bit
  • Next copy of a repeat

    The next copy when the last one to four objects were copied at one step twice or more.

    step = anchor(B₀) − anchor(A₀); tol = max(10⁻⁶, 0.004 × |step|); next = last group moved by step

    Drawing autocomplete autocomplete.js
    • CadCraft
    64-bit
  • Next period of a stair

    The next riser and tread of an open polyline whose steps repeat.

    dⱼ = pⱼ − pⱼ₋₁; repeats when |dⱼ − dⱼ₋ₚ| ≤ max(10⁻⁶, 0.004 × longest step); new vertex = last vertex + dⱼ

    Drawing autocomplete autocomplete.js
    • CadCraft
    64-bit
  • Chain of segments through the newest line

    The run of connected line and polyline segments that the newest line or polyline belongs to, as an ordered list of vertices.

    Drawing autocomplete autocomplete.js
    • CadCraft
    64-bit
  • Do two segments cross

    Whether the closing side would cross another side of the figure.

    cross(o, a, b) = (a.x − o.x)(b.y − o.y) − (a.y − o.y)(b.x − o.x); cross when d₁·d₂ < 0 and d₃·d₄ < 0

    Drawing autocomplete autocomplete.js
    • CadCraft
    64-bit
  • Closing sides of a nearly closed figure

    The two missing sides of a rectangle drawn as two sides, or the closing side of a chain of three or more.

    rectangle: p₄ = v₀ + (v₂ − v₁), offered when |u·w| ÷ (|u||w|) ≤ 0.01; chain: closing side v_last → v₀

    Drawing autocomplete autocomplete.js
    • CadCraft
    64-bit
  • Next point of a running line

    The point offered after the points picked so far in LINE or PLINE: the next stair step, a rectangle's fourth corner, the first point again, or one more equal step.

    tol = max(10⁻⁶, 0.002 × longest step); square when |u·v| ≤ 0.002 × |u||v|; next = last point + a stored step

    Drawing autocomplete autocomplete.js
    • CadCraft
    64-bit
  • Merging near-equal positions

    Sorts edge positions and merges those that are within a tolerance of each other.

    Automatic dimensions autodim.js
    • CadCraft
    64-bit
  • Level and plumb edges, circles and points

    Collects the positions to dimension from the chosen objects and the size of the box round them.

    diagonal = √(w² + h²); plumb when |Δx| ≤ tol; level when |Δy| ≤ tol

    Automatic dimensions autodim.js
    • CadCraft
    64-bit
  • Is the dimension already there

    A key that is equal for two dimensions of one kind with the same end points.

    key = kind : round(x₁ ÷ g), round(y₁ ÷ g), round(x₂ ÷ g), round(y₂ ÷ g), g = 20 × tol

    Automatic dimensions autodim.js
    • CadCraft
    64-bit
  • Chains and overall dimensions

    The dimensions strung between neighboring edge positions along each chosen side, and one overall dimension outside them.

    minLen = max(0.003 × diagonal, 10 × tol); chain line at box edge ∓ 6 × text height; overall line 5 × text height further out

    Automatic dimensions autodim.js
    • CadCraft
    64-bit
  • Opening widths

    The width of a gap between collinear lines on one layer, taken as a door or window opening.

    w = next.lo − this.hi; kept when minLen ≤ w ≤ 0.35 × diagonal and w ≤ 0.8 × the longer neighbor

    Automatic dimensions autodim.js
    • CadCraft
    64-bit
  • Hole diameters

    One diameter dimension for each size of circle.

    p₁ = center + r·(cos 45°, sin 45°); text at center + (r + 3 × text height)·(cos 45°, sin 45°)

    Automatic dimensions autodim.js
    • CadCraft
    64-bit
  • Longitude and latitude to web Mercator

    The web Mercator x and y in meters for a longitude and latitude in degrees.

    x = R·λ·π ÷ 180; y = R·ln(tan(π ÷ 4 + φ·π ÷ 360)), R = 6378137

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Web Mercator to longitude and latitude

    The longitude and latitude in degrees for a web Mercator x and y in meters.

    λ = x ÷ R × 180 ÷ π; φ = (2·atan(e^(y ÷ R)) − π ÷ 2) × 180 ÷ π

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Standard tile grid

    The origin and the resolution of each zoom level of the usual 256-pixel web Mercator tiles.

    origin = (−πR, πR); res(z) = 2πR ÷ 256 ÷ 2^z, z = 0…22

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Tile that holds a place

    The tile column and row at a zoom level for a longitude and latitude.

    col = ⌊(x + πR) ÷ (res × 256)⌋; row = ⌊(πR − y) ÷ (res × 256)⌋

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Tiles covering a box

    The tiles of a grid that cover a box, each with its bounds in the grid's units.

    bounds = [ox + c·tw, oy − (r + 1)·th, ox + (c + 1)·tw, oy − r·th], tw = res × tile width

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Meters per unit of a coordinate system

    The length in meters of one degree, foot, US survey foot or meter, for turning a WMTS scale into a resolution.

    degree: 2π × 6378137 ÷ 360; foot: 0.3048; US survey foot: 1200 ÷ 3937; otherwise 1

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Tile grid of a WMTS tile matrix set

    The resolution and top-left corner of each level of a WMTS tile matrix set.

    res = scale denominator × 0.00028 ÷ meters per unit

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • World file to a pixel-corner transform

    The transform from pixel corners to coordinates for a picture, from the six numbers of its world file.

    x₀ = C − A ÷ 2 − B ÷ 2; y₀ = F − D ÷ 2 − E ÷ 2

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Pixel to coordinates

    The coordinates of a pixel position in a picture's own system.

    x = g₀ + u·g₁ + v·g₂; y = g₃ + u·g₄ + v·g₅

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Numbers in a map request

    How the corners of the requested box are written into a WMS or map-server export address.

    |v| ≥ 10,000: v.toFixed(3); otherwise v.toPrecision(12)

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Affine through three points

    The affine transform that carries three source points onto three destination points.

    det = (u₁ − u₀)(v₂ − v₀) − (u₂ − u₀)(v₁ − v₀); a = ((x₁ − x₀)(v₂ − v₀) − (x₂ − x₀)(v₁ − v₀)) ÷ det

    Map pictures warped onto the plan basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    32-bit, display only
  • Cells of a warped picture

    The cells a picture is cut into so that each can be drawn with one affine transform.

    split while max |affine(p) − exact(p)| > tol over the fourth corner, the middle and the four edge midpoints

    Map pictures warped onto the plan basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    32-bit, display only
  • Tile level for the screen

    Which level of a tile grid is drawn at the current zoom.

    the coarsest level with res ≤ 1.5 × screen resolution

    Map pictures warped onto the plan basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    32-bit, display only
  • Rounding of reported numbers

    Rounds a number before it is handed to an assistant or a script.

    num(v) = round(v × 10⁹) ÷ 10⁹; rnd6(v) = num(round(v × 10⁶) ÷ 10⁶)

    Values given to assistants and scripts agents.js
    • CadCraft
    64-bit
  • Extents, paper and viewport sizes

    The drawing's extents and each sheet's paper and viewport sizes in the drawing's description.

    Values given to assistants and scripts agents.js
    • CadCraft
    64-bit
  • An object's fields, length and area

    One object as plain values, with its length and area where it has them.

    length = Σ primLength(primitive); area = entityArea(object).area

    Values given to assistants and scripts agents.js
    • CadCraft
    64-bit
  • An object's state for change checks

    A flat set of an object's values that is compared later to see whether the object changed.

    Values given to assistants and scripts agents.js
    • CadCraft
    64-bit
  • Text height against the allowed list

    Whether a text's height is one of the heights a standards check allows.

    |h − e.h| ≤ 10⁻⁶ × max(1, h)

    Values given to assistants and scripts agents.js
    • CadCraft
    64-bit
  • Plot scale from text

    The scale number for text such as 1:100, an architectural scale label, or fit.

    a:b → n = b ÷ a

    Values given to assistants and scripts agents.js
    • CadCraft
    64-bit
  • Sheet a plot prints

    The sheet and its size for a plot asked for by an assistant: a layout, the extents, or a window of the model.

    Values given to assistants and scripts agents.js
    • CadCraft
    64-bit
  • Size and units of the SVG plot

    The SVG file's size in millimeters and the number of file units per millimeter.

    file units = mm × 10; width = sheet width in mm, rounded to 9 decimals

    Values given to assistants and scripts agents.js
    • CadCraft
    64-bit
  • Coordinates in the SVG plot

    How points, widths and matrix entries are transformed and written into the SVG file.

    (x′, y′) = M · (x, y, 1); text = round(v × 1000) ÷ 1000; width scale = √|det M|

    Values given to assistants and scripts agents.js
    • CadCraft
    64-bit
  • Arcs in the SVG plot

    An arc written as a run of straight chords.

    n = max(2, ⌈|sweep| ÷ 2°⌉); pᵢ = center + r·(cos, sin)(a₀ + sweep·i ÷ n)

    Values given to assistants and scripts agents.js
    • CadCraft
    64-bit
  • Text in the SVG plot

    The matrix, position and size written for a piece of text.

    transform = matrix(a b c d e f), each entry rounded to 3 decimals

    Values given to assistants and scripts agents.js
    • CadCraft
    64-bit
  • Insertion point of a block placed by an assistant

    The command-line input that places a block at a given point, scale and rotation.

    Values given to assistants and scripts agents.js
    • CadCraft
    64-bit
  • Ortho: the point along the nearer axis

    The point a click stands for when ortho is on and there is a base point.

    u = c·Δx + s·Δy; v = −s·Δx + c·Δy; point = base + u·(c, s) if |u| ≥ |v|, else base + v·(−s, c)

    Cursor point and status readouts cadcraft.js
    • CadCraft
    64-bit
  • Coordinates, distance and angle in the status line

    The cursor's coordinates and, during a command, the distance and angle from the base point.

    Δ = √(Δx² + Δy²); angle = atan2(Δy, Δx) − UCS angle, normalized to 0…360°

    Cursor point and status readouts cadcraft.js
    • CadCraft
    64-bit
  • Length text in the model and on a sheet

    A length written for the status line, the tracking labels and the cursor box.

    Cursor point and status readouts cadcraft.js
    • CadCraft
    64-bit
  • Distance and angle beside the cursor

    The live distance or angle shown in the box by the cursor while a command waits for one.

    d = √(Δx² + Δy²); angle = atan2(Δy, Δx), normalized to 0…360°

    Cursor point and status readouts cadcraft.js
    • CadCraft
    64-bit
  • Size of the plot area on paper

    The width and height of the chosen area at the chosen scale, shown in the Plot dialog.

    w = (maxX − minX) × s, shown as round(w × 10) ÷ 10

    Cursor point and status readouts cadcraft.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.