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

  • 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
  • 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
  • Number typed in Quick select

    The number a property is compared with in the Quick select dialog.

    Cursor point and status readouts cadcraft.js
    • CadCraft
    64-bit
  • Turn sense of an angle constraint

    Whether the angle between two constrained lines is measured counter-clockwise or clockwise after a mirror or a trim.

    sign = +1 if atan2(u × v, u · v) ≥ 0, else −1

    Constraints kept through mirror and trim ckeep.js
    • CadCraft
    64-bit
  • Which piece holds the original's ends

    The piece of a trimmed line or arc that still has the original's start, and the one that still has its end.

    start piece: t₀ ≤ 10⁻⁹; end piece: t₁ ≥ 1 − 10⁻⁹

    Constraints kept through mirror and trim ckeep.js
    • CadCraft
    64-bit
  • Numbers in prompts and messages

    A number written for a prompt's default or a message in the command history.

    |n| < 10⁻¹⁰ → 0; otherwise n.toFixed(4) without trailing zeros

    Typed points, distances and angles commands.js
    • CadCraft
    64-bit
  • Typed distance, number and angle

    The value a prompt takes when a distance, a number or an angle is typed.

    angle = degrees × π ÷ 180 (+ UCS angle for an absolute angle)

    Typed points, distances and angles commands.js
    • CadCraft
    64-bit
  • Distance or angle shown by two clicks

    The distance or the angle a prompt takes when it is shown by picking two points.

    d = √(Δx² + Δy²); angle = atan2(Δy, Δx)

    Typed points, distances and angles commands.js
    • CadCraft
    64-bit
  • Typed point

    The point for typed coordinates: absolute, relative to the last point, polar, or a distance along the cursor direction.

    x,y → UCS to world; @x,y → last + R(ucs)·(x, y); d<a → from + d·(cos, sin)(a·π ÷ 180 + UCS angle); d → base + d·(cos, sin)(atan2(cursor − base))

    Typed points, distances and angles commands.js
    • CadCraft
    64-bit
  • Calculation on the command line

    The result CAL prints for an expression such as 12'6"+3/4" or 2*450mm.

    raw = value.toPrecision(12)

    Typed points, distances and angles commands.js
    • CadCraft
    64-bit
  • Circle through three points

    The center and radius of the circle through three picked points.

    d = 2·(aₓ(b_y − c_y) + bₓ(c_y − a_y) + cₓ(a_y − b_y)); centerₓ = (|a|²(b_y − c_y) + |b|²(c_y − a_y) + |c|²(a_y − b_y)) ÷ d; r = |a − center|

    Shapes made by the draw commands commands.js
    • CadCraft
    64-bit
  • Arc through three points

    The center, radius and end angles of the arc from a start point through a second point to an end point.

    center, r from circle3; counter-clockwise when (m − s) × (e − s) > 0; a₀ = atan2(s − center), a₁ = atan2(e − center)

    Shapes made by the draw commands commands.js
    • CadCraft
    64-bit
  • Arc segment of a polyline

    The bulge of a polyline's arc segment that leaves the last point along the previous segment's direction and ends at the picked point.

    φ = angle(p → q) − tangent at p, wrapped to −π…π; bulge = tan(φ ÷ 2)

    Shapes made by the draw commands commands.js
    • CadCraft
    64-bit
  • Circle from the two ends of a diameter

    The center and radius of a circle given by two opposite points on it.

    center = (a + b) ÷ 2; r = |b − a| ÷ 2

    Shapes made by the draw commands commands.js
    • CadCraft
    64-bit
  • Arc from center, start and end

    The radius and end angles of an arc given its center, its start point and a point toward its end.

    r = |start − center|; a₀ = atan2(start − center); a₁ = atan2(end − center)

    Shapes made by the draw commands commands.js
    • CadCraft
    64-bit
  • Rectangle from two corners

    The closed four-corner polyline between two picked corners.

    Shapes made by the draw commands commands.js
    • CadCraft
    64-bit
  • Regular polygon

    The corners of a regular polygon inscribed in or drawn round a circle.

    R = r (inscribed) or r ÷ cos(π ÷ n) (circumscribed); pᵢ = center + R·(cos, sin)(a₀ + i·2π ÷ n)

    Shapes made by the draw commands commands.js
    • CadCraft
    64-bit
  • Ellipse from an axis and a half-width

    The center, major-axis vector and axis ratio of an ellipse.

    ratio = half-width ÷ L, kept in 10⁻⁶…1; if half-width d > L: major = d·(−m_y, mₓ) ÷ L, ratio = L ÷ d

    Shapes made by the draw commands commands.js
    • CadCraft
    64-bit
  • Construction line at an angle

    The direction of a construction line given by a typed angle, alone or measured from a picked straight object.

    direction = (cos a, sin a); with a reference: a = atan2(u_y, uₓ) + typed angle

    Shapes made by the draw commands commands.js
    • CadCraft
    64-bit
  • Construction line that bisects an angle

    The direction of the line through a vertex that halves the angle between two legs.

    b = unit(u₀ + u₁), u₀, u₁ the unit vectors of the legs

    Shapes made by the draw commands commands.js
    • CadCraft
    64-bit
  • Construction line parallel at a distance

    The point and direction of a construction line parallel to a picked straight object.

    foot(q) = on + ((q − on)·u)·u; new point = foot(pick) + d·n, n = unit(side − foot(side))

    Shapes made by the draw commands commands.js
    • CadCraft
    64-bit
  • Lines of single-line text

    Where each further line of TEXT is placed below the first.

    line k at start + k × 1.667 × h, at right angles to the text direction

    Shapes made by the draw commands commands.js
    • CadCraft
    64-bit
  • Paragraph text box

    The box between two picked corners, measured along the text's own direction, and the width and insertion point stored from it.

    lx = d·u; ly = d·n, u = (cos rot, sin rot), n = (−sin rot, cos rot)

    Shapes made by the draw commands commands.js
    • CadCraft
    64-bit
  • Move or copy through a transform

    Applies one transform to the selected objects, replacing them or adding copies.

    Move, rotate, scale, mirror, array, stretch and lengthen commands.js
    • CadCraft
    64-bit
  • Displacement for MOVE and COPY

    The translation from a base point to a second point, or a typed displacement.

    M = T(p − base)

    Move, rotate, scale, mirror, array, stretch and lengthen commands.js
    • CadCraft
    64-bit
  • Rotate and scale about a base point

    The transform for ROTATE and SCALE.

    M = T(base) · R(a) · T(−base); M = T(base) · S(s) · T(−base)

    Move, rotate, scale, mirror, array, stretch and lengthen commands.js
    • CadCraft
    64-bit
  • Mirror across a line

    The transform that mirrors the selection across the line through two picked points.

    M = T(a) · [cos 2θ, sin 2θ; sin 2θ, −cos 2θ] · T(−a), θ = atan2(b − a)

    Move, rotate, scale, mirror, array, stretch and lengthen commands.js
    • CadCraft
    64-bit
  • Copies of a rectangular or polar array

    The copies an array makes, in rows and columns or round a center.

    rectangular: T(k·dx, r·dy); polar: step = fill ÷ items (full circle) or fill ÷ (items − 1); copy i = rotation by step × i about the center

    Move, rotate, scale, mirror, array, stretch and lengthen commands.js
    • CadCraft
    64-bit
  • Which points a stretch moves

    Whether a point lies inside one of the crossing windows that define a stretch.

    minX − 10⁻⁹ ≤ x ≤ maxX + 10⁻⁹ and minY − 10⁻⁹ ≤ y ≤ maxY + 10⁻⁹

    Move, rotate, scale, mirror, array, stretch and lengthen commands.js
    • CadCraft
    64-bit
  • Length change for LENGTHEN

    How much an object's end moves for the delta, percent, total and dynamic options.

    percent: Δ = L × (p ÷ 100 − 1); total: Δ = total − L; total angle: Δθ = angle − sweep; dynamic: Δ = ((cursor − A)·(B − A)) ÷ |B − A| − |B − A|

    Move, rotate, scale, mirror, array, stretch and lengthen commands.js
    • CadCraft
    64-bit
  • Nearest position on a line or arc

    The position (0 at the start, 1 at the end) of the point on a line or arc nearest a given point.

    line: t = clamp(((q − p₁)·(p₂ − p₁)) ÷ |p₂ − p₁|², 0, 1); arc: t = (angle from the start) ÷ sweep

    Move, rotate, scale, mirror, array, stretch and lengthen commands.js
    • CadCraft
    64-bit
  • Point on an object nearest a pick

    Where a break point or a pick lands on a line, arc, circle or polyline.

    Move, rotate, scale, mirror, array, stretch and lengthen commands.js
    • CadCraft
    64-bit
  • Offset distance through a point

    The distance OFFSET uses: the typed one, or the distance from the object to a picked point.

    through: d = min over the primitives of |p − nearest point on the primitive|

    Move, rotate, scale, mirror, array, stretch and lengthen commands.js
    • CadCraft
    64-bit
  • Distance, Δx, Δy and angle between two points

    What DIST prints for two picked points.

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

    Distance, area, angle and point inquiries commands.js
    • CadCraft
    64-bit
  • Area and perimeter of picked points

    The area and perimeter of the outline through points picked one by one.

    area = |Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)| ÷ 2; perimeter = Σ |pᵢ₊₁ − pᵢ|

    Distance, area, angle and point inquiries commands.js
    • CadCraft
    64-bit
  • Area and perimeter of an object

    What AREA prints for a picked circle, polyline, ellipse or hatch.

    Distance, area, angle and point inquiries commands.js
    • CadCraft
    64-bit
  • Running area total

    The total AREA keeps while areas are added and subtracted.

    total = Σ ± areaᵢ

    Distance, area, angle and point inquiries commands.js
    • CadCraft
    64-bit
  • angle = |atan2(b − v) − atan2(a − v)|, folded to 0…180°; arc: its sweep, with 0 read as 360°

    Distance, area, angle and point inquiries commands.js
    • CadCraft
    64-bit
  • Coordinates of a point

    What ID prints for a picked point.

    Distance, area, angle and point inquiries commands.js
    • CadCraft
    64-bit
  • One object in a line of text

    The description LIST prints and assistants read for an object: its points, length, radius and angles.

    line length = √(Δx² + Δy²); angles in degrees = radians × 180 ÷ π

    Distance, area, angle and point inquiries commands.js
    • CadCraft
    64-bit
  • Units of exported points

    The factor between drawing units and the units of the point file EXPORTPOINTS writes.

    factor = mm per unit ÷ 1000 (meters), ÷ 304.8 (feet), or 1 (drawing units)

    Distance, area, angle and point inquiries commands.js
    • CadCraft
    64-bit
  • Two origins of a linear dimension

    The two points a linear or aligned dimension measures between: picked, or the ends of a picked object.

    arc end = center + r·(cos a, sin a); circle: (cx − r, cy) and (cx + r, cy)

    Where dimensions are attached commands.js
    • CadCraft
    64-bit
  • Horizontal or vertical

    Whether a linear dimension measures along the X or the Y axis, from where its line is placed.

    Where dimensions are attached commands.js
    • CadCraft
    64-bit
  • Point on the circle for a radius or diameter

    The point on an arc or circle that a radius or diameter dimension is attached to.

    p₁ = center + r·(cos, sin)(atan2(cursor − center))

    Where dimensions are attached commands.js
    • CadCraft
    64-bit
  • Are two lines parallel

    Whether two picked lines have an angle between them that can be dimensioned.

    parallel when |e × f| < 10⁻¹² × |e| × |f|

    Where dimensions are attached commands.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.