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

  • Hatches as solids or outlines (R12)

    Writes a filled triangle or quadrilateral as a SOLID and any other hatch as closed polylines of its rings.

    DXF writing: numbers as text dxf.js
    • CadCraft
    64-bit
  • Text (R12)

    A text's position, height, rotation, width factor and oblique angle.

    rotation° = rot × 180 ÷ π; oblique° = obl × 180 ÷ π

    DXF writing: numbers as text dxf.js
    • CadCraft
    64-bit
  • Multi-line text as single lines (R12)

    The position of each line of a multi-line text, written as separate single-line texts.

    p = T(x, y) × R(rot) × (anchor x of the text box, baseline of line k)

    DXF writing: numbers as text dxf.js
    • CadCraft
    64-bit
  • Construction lines as segments (R12)

    Writes an infinite line or ray as a line across the drawing's extents.

    a = p + d × t₀; b = p + d × t₁

    DXF writing: numbers as text dxf.js
    • CadCraft
    64-bit
  • Extents of what was written (R12)

    The smallest and largest x and y of the model-space objects written.

    min and max over the written points

    DXF writing: numbers as text dxf.js
    • CadCraft
    64-bit
  • Linetype pattern (R12)

    A linetype's total pattern length and its dashes and gaps.

    length = Σ |elementᵢ|

    DXF writing: numbers as text dxf.js
    • CadCraft
    64-bit
  • Center mark size (R12)

    The center mark size written with each dimension style.

    DIMCEN = arrow size ÷ 2 (2.5 when no arrow size is set)

    DXF writing: numbers as text dxf.js
    • CadCraft
    64-bit
  • Number text (2000)

    The text every real number is written as in a DXF 2000 file.

    not finite → 0.0; |n| < 1e-12 → 0.0; otherwise n rounded to 15 significant digits

    DXF writing: numbers as text dxf2000.js
    • CadCraft
    64-bit
  • Radians to degrees (2000)

    Converts an angle to the degrees DXF stores.

    degrees = (r × 180) ÷ π

    DXF writing: numbers as text dxf2000.js
    • CadCraft
    64-bit
  • Point (2000)

    Writes a point as three groups.

    x → f(x); y → f(y); z → f(z); a missing coordinate → 0.0

    DXF writing: numbers as text dxf2000.js
    • CadCraft
    64-bit
  • Arc (2000)

    An arc's center, radius and its angles in degrees.

    start° = (a₀ × 180) ÷ π; end° = (a₁ × 180) ÷ π

    DXF writing: numbers as text dxf2000.js
    • CadCraft
    64-bit
  • Ellipse (2000)

    An ellipse's center, major axis, axis ratio and start and end parameters, with the ratio brought to 1 or less.

    ratio > 1: major′ = (−m_y × ratio, m_x × ratio); ratio′ = 1 ÷ ratio; parameters − π ÷ 2

    DXF writing: numbers as text dxf2000.js
    • CadCraft
    64-bit
  • Hatch pattern lines (2000)

    A pattern hatch's angle, scale and each pattern line's angle, base, offset and dashes.

    angles° = (radians × 180) ÷ π

    DXF writing: numbers as text dxf2000.js
    • CadCraft
    64-bit
  • Spline (2000)

    A spline's degree, knots, weights, control points and fit points.

    knot, control point and fit point tolerances written as 1E-10

    DXF writing: numbers as text dxf2000.js
    • CadCraft
    64-bit
  • Extended data values (2000)

    Writes the extra values attached to an object: text, reals and whole numbers.

    code 1040: f(value); code 1070: value | 0

    DXF writing: numbers as text dxf2000.js
    • CadCraft
    64-bit
  • Point in absolute coordinates

    One scan point, from Cartesian or spherical fields, moved by the scan's pose.

    spherical: x = r cos e cos a, y = r cos e sin a, z = r sin e; then p′ = R × p + T

    E57 point cloud reading e57.js
    • CadCraft
    • BimCraft
    64-bit
  • Rotation matrix from the pose quaternion

    The 3 × 3 rotation of a scan from its quaternion (w, x, y, z).

    q ÷ |q|; R = [1 − 2(y² + z²), 2(xy − zw), 2(xz + yw); 2(xy + zw), 1 − 2(x² + z²), 2(yz − xw); 2(xz − yw), 2(yz + xw), 1 − 2(x² + y²)]

    E57 point cloud reading e57.js
    • CadCraft
    • BimCraft
    64-bit
  • Field values of a packet

    Decodes one field of a data packet into numbers: 64-bit floats, 32-bit floats or scaled integers.

    float: as stored; integer: (raw + minimum) × scale + offset

    E57 point cloud reading e57.js
    • CadCraft
    • BimCraft
    64-bit
  • Bit-packed integer

    Reads an unsigned integer of up to 64 bits from a bit position in a packet.

    value = Σ chunkᵢ × 2^(32 i), chunks of up to 32 bits

    E57 point cloud reading e57.js
    • CadCraft
    • BimCraft
    64-bit
  • Bits from the stream

    Extracts up to 32 bits starting at any bit of a byte buffer, least significant bit first.

    E57 point cloud reading e57.js
    • CadCraft
    • BimCraft
    64-bit
  • Field description from the XML

    How many bits an integer field uses, and its minimum, scale and offset.

    bits = smallest b with 2ᵇ > maximum − minimum (at most 64)

    E57 point cloud reading e57.js
    • CadCraft
    • BimCraft
    64-bit
  • Thinning to the point budget

    How many points are kept and at what rate when a file has more points than the budget.

    cap = max(1, min(listed, ⌊budget⌋)); rate = min(1, cap ÷ listed); keep a point each time the running sum of rate reaches 1

    E57 point cloud reading e57.js
    • CadCraft
    • BimCraft
    64-bit
  • Points from the library's text

    Parses the x y z lines the web-e57 library returns and keeps the bounds and the thinned points.

    x, y, z = Number of each field of a line

    E57 point cloud reading e57.js
    • CadCraft
    • BimCraft
    64-bit
  • Solve for a parameter

    The value of the named parameter for which the expression equals the target.

    secant: c = b − f(b) × (b − a) ÷ (f(b) − f(a)); accept when |f| ≤ 1e-9 × max(1, |target|, |x₀|)

    Solving an expression for one parameter expr.js
    • CadCraft
    • BimCraft
    • PartCraft
    64-bit
  • Rounding of the answer

    Replaces the answer by its 13-digit rounding when the two are practically equal.

    r = x to 13 significant digits; use r when |r − x| ≤ 1e-12 × max(1, |x|)

    Solving an expression for one parameter expr.js
    • CadCraft
    • BimCraft
    • PartCraft
    64-bit
  • View frames

    The right, up and toward-the-viewer directions of the seven standard views.

    iso: u = (1, 1, 0) ÷ √2; v = (−1, 1, 2) ÷ √6; w = (1, −1, 1) ÷ √3

    Flat views of 3D solids flatview.js
    • CadCraft
    64-bit
  • Edges and triangles in the view's frame

    Every vertex of the model as (right, up, depth) in the view, and which soft edges are outlines from this side.

    q = (p · u, p · v, p · w); soft edge kept when its two faces face opposite ways

    Flat views of 3D solids flatview.js
    • CadCraft
    64-bit
  • Working tolerance

    The tolerance every later step uses, from the size of the projected model.

    diag = √(Δu² + Δv²); tol = diag × 1e-6

    Flat views of 3D solids flatview.js
    • CadCraft
    64-bit
  • Is a point hidden

    Says whether a point of an edge lies behind some triangle of the model.

    l₁, l₂ from signed areas ÷ triangle area; l₃ = 1 − l₁ − l₂; hidden when all ≥ 1e-9 and l₁ z_a + l₂ z_b + l₃ z_c > depth + tol

    Flat views of 3D solids flatview.js
    • CadCraft
    64-bit
  • Visible and hidden runs of an edge

    Splits an edge into stretches that are visible and stretches that are hidden.

    n = clamp(⌈L ÷ (diag ÷ 300)⌉, 1, 400) samples; each change bisected until (hi − lo) × L ≤ tol

    Flat views of 3D solids flatview.js
    • CadCraft
    64-bit
  • Merging pieces on one line

    Groups segments that lie on the same line and joins their overlapping spans.

    key = round(atan2(dy, dx) × 1e6) and round(offset ÷ (20 × tol)); spans joined when the gap ≤ tol

    Flat views of 3D solids flatview.js
    • CadCraft
    64-bit
  • Merged lines back to segments

    Writes each merged span as a segment, and removes from hidden lines what a visible line covers.

    point = offset × (−dy, dx) + t × (dx, dy)

    Flat views of 3D solids flatview.js
    • CadCraft
    64-bit
  • Scale from text

    Reads a scale typed as 1:50, 2:1, 1/20 or 0.5.

    a:b → a ÷ b; accepted when 0 < scale < 1e6

    Flat views of 3D solids flatview.js
    • CadCraft
    64-bit
  • Paper units per meter and automatic scale

    How many drawing or paper units one meter of the model is, and the largest standard scale that fits the sheet.

    inch sheet: 1 ÷ 0.0254; mm sheet: 1000; model: 1 ÷ meters per unit; fit: size × units per meter × scale ≤ 0.45 × paper size

    Flat views of 3D solids flatview.js
    • CadCraft
    64-bit
  • View lines in drawing units

    The 2D lines of the view, centered on the block's base point and scaled.

    x = (u − u_center) × f; y = (v − v_center) × f; f = units per meter × scale

    Flat views of 3D solids flatview.js
    • CadCraft
    64-bit
  • GEODATA fields from the drawing's location

    The design point, reference point, units and north vector written to the file.

    rot = degrees × π ÷ 180; north = (round₉(sin rot), round₉(cos rot))

    Drawing location written to DWG and DXF geodwg.js
    • CadCraft
    64-bit
  • Location from another program's GEODATA

    Turns a file's GEODATA into the drawing's coordinate system, placement point and rotation.

    rot = round₉(atan2(north.x, north.y) × 180 ÷ π)

    Drawing location written to DWG and DXF geodwg.js
    • CadCraft
    64-bit
  • Fingerprint of the written location

    Decides whether the GEODATA in a file is still the one CadCraft wrote or another program moved the location since.

    Drawing location written to DWG and DXF geodwg.js
    • CadCraft
    64-bit
  • Cut parameters

    Where along an object each cutting edge crosses it.

    t = segment index + parameter of the intersection; t = round(t × 10⁹) ÷ 10⁹

    Trim geom.js
    • CadCraft
    64-bit
  • Piece between two parameters

    The part of a line, arc, open polyline or construction line between two parameters, as a new object.

    line: p₁ + (p₂ − p₁)·t; arc: a0 + sweep·t; polyline arc piece: bulge = tan(atan(b)·(t_b − t_a))

    Trim geom.js
    • CadCraft
    64-bit
  • Trim at a pick

    The pieces that stay when the part of an object round the picked point is cut away.

    circle: remaining arc from angle t_hi × 2π to t_lo × 2π

    Trim geom.js
    • CadCraft
    64-bit
  • Splitting into pieces

    An object divided at all its cutting edges into pieces that can be removed one by one.

    Trim geom.js
    • CadCraft
    64-bit
  • Points along an ellipse

    The points that stand in for an ellipse or elliptical arc.

    n = max(8, ⌈steps × sweep ÷ 2π⌉); t = t0 + (t1 − t0)·i ÷ n; p = c + R(rot)·(a·cos t, a·ratio·sin t)

    Ellipses and curves as short segments geom.js
    • CadCraft
    64-bit
  • Ellipse area and perimeter

    The area and perimeter of an ellipse, or the area and length of an elliptical arc.

    full: area = π·a·b; perimeter ≈ π(a + b)(1 + 3h ÷ (10 + √(4 − 3h))), h = ((a − b) ÷ (a + b))²; arc: 720 chords per turn

    Ellipses and curves as short segments geom.js
    • CadCraft
    64-bit
  • A piece through a transform

    A line or arc piece of a block put through the block reference's transform.

    uniform: center M·c, radius r·s, start angle = atan2(M·start − M·c); otherwise n = max(8, ⌈48 × sweep ÷ 2π⌉) chords

    Ellipses and curves as short segments geom.js
    • CadCraft
    64-bit
  • Outline of an object as points

    The outline a revision cloud follows, with arcs and curves in short pieces.

    Ellipses and curves as short segments geom.js
    • CadCraft
    64-bit
  • Even spacing along a path

    Points spaced evenly along a run of points, about a given step apart.

    n = max(1 or 3, round(L ÷ step)); target k = L·k ÷ n; point = linear interpolation on the segment that holds the target

    Ellipses and curves as short segments geom.js
    • CadCraft
    64-bit
  • Revision cloud

    A polyline of equal arcs along a path, bulging outward.

    bulge = ± tan(2π ÷ 3 ÷ 4) = ± tan 30°; outward side from the sign of Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)

    Ellipses and curves as short segments geom.js
    • CadCraft
    64-bit
  • Exploding a spline

    Replaces a spline with a polyline along the curve.

    Ellipses and curves as short segments geom.js
    • CadCraft
    64-bit
  • Solver tolerance

    The size below which an equation counts as met.

    tol = 1e-9 × max(1, width, height, |min x|, |max x|, |min y|, |max y|)

    2D constraint solver gsolve.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.