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

  • Extend to a boundary

    An object with the end nearest the pick moved out to the closest boundary it reaches.

    Offset, extend, break and lengthen geom.js
    • CadCraft
    64-bit
  • Break between two points

    An object with the part between two picked points removed, or split at one point.

    Offset, extend, break and lengthen geom.js
    • CadCraft
    64-bit
  • Lengthen by an amount

    An object made longer or shorter by a length, or an arc by an angle, at the end nearest the pick.

    line: moved end = fixed end ± u·(L + δ); arc: new sweep = sweep + δ ÷ r; polyline arc end: bulge = ± tan(new sweep ÷ 4)

    Offset, extend, break and lengthen geom.js
    • CadCraft
    64-bit
  • Fillet of two lines

    The arc of a given radius tangent to two lines and the lines cut back to it.

    half = acos(ua·ub) ÷ 2; t = r ÷ tan(half); center = corner + bisector × r ÷ sin(half)

    Fillet and chamfer geom.js
    • CadCraft
    64-bit
  • Tangent points and center at a corner

    The two tangent points and the center of a fillet at the corner of two straight pieces.

    half = acos(ua·ub) ÷ 2; t = r ÷ tan(half); center = corner + bisector × r ÷ sin(half)

    Fillet and chamfer geom.js
    • CadCraft
    64-bit
  • Fillet arc between two tangent points

    The arc entity of the fillet, the short way round from one tangent point to the other.

    Fillet and chamfer geom.js
    • CadCraft
    64-bit
  • Cutting an object back to the corner

    Moves one end of a line, arc or polyline segment to the tangent or chamfer point.

    arc end angle = atan2(T − center); polyline arc bulge = ± tan(sweep ÷ 4)

    Fillet and chamfer geom.js
    • CadCraft
    64-bit
  • Fillet of two picked objects

    The fillet arc and trimmed ends for two lines, a line and an arc or circle, two arcs, two segments of one polyline, or two parallel lines.

    with an arc: center = intersection of the two pieces offset by r; parallel lines: half circle of radius gap ÷ 2

    Fillet and chamfer geom.js
    • CadCraft
    64-bit
  • Chamfer distances

    How far to cut back each side of a corner, from two distances or from a length and an angle.

    angle method: θ = acos(ua·ub); da = len; db = len·sin α ÷ sin(θ + α)

    Fillet and chamfer geom.js
    • CadCraft
    64-bit
  • Chamfer of two picked pieces

    The chamfer line and trimmed ends for two straight pieces.

    Fillet and chamfer geom.js
    • CadCraft
    64-bit
  • Removing old fillet arcs

    Finds the fillet arcs a polyline already has and restores the sharp corners before a new radius is applied.

    θ = 4·atan(b); fillet when direction in = chord − θ ÷ 2 and direction out = chord + θ ÷ 2

    Fillet and chamfer geom.js
    • CadCraft
    64-bit
  • Every corner of a polyline

    Fillets or chamfers each corner of a polyline where two straight segments meet.

    sweep = π − acos(ua·ub); bulge = tan(sweep ÷ 4) × turn

    Fillet and chamfer geom.js
    • CadCraft
    64-bit
  • Polygon area and perimeter

    The signed area and the perimeter of a closed run of points.

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

    Area, perimeter and length geom.js
    • CadCraft
    64-bit
  • Polyline area and length

    The area enclosed by a polyline with arc segments, and its length.

    area = ½ |Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ) + Σ ± r²(θ − sin θ)|; θ = 4·atan|b|; r = c ÷ (2·sin(θ ÷ 2)); arc length = r·θ

    Area, perimeter and length geom.js
    • CadCraft
    64-bit
  • Circle area and circumference

    The area and circumference of a circle.

    area = π·r²; circumference = 2π·r

    Area, perimeter and length geom.js
    • CadCraft
    64-bit
  • Hatch area and perimeter

    The filled area of a hatch with holes, and the total length of its boundaries.

    area = |Σ ± |ring area||, − for a ring inside an odd number of other rings; perimeter = Σ ring perimeters

    Area, perimeter and length geom.js
    • CadCraft
    64-bit
  • Length of a line, arc, polyline or spline

    The length used by the length and lengthen commands.

    line: √(Δx² + Δy²); arc: r × ((a1 − a0) mod 2π); polyline: Σ segment lengths

    Area, perimeter and length geom.js
    • CadCraft
    64-bit
  • Joining objects

    One line, arc, circle or polyline made from pieces that lie on one line, on one circle, or meet end to end.

    T = 1e-9 × max(width, height, 1); pieces join when they agree within 1000 × T

    Join and stretch geom.js
    • CadCraft
    64-bit
  • Bulge that keeps an arc's height

    The new bulge of an arc whose chord changes length, so that its height stays the same.

    b′ = b·c₀ ÷ c₁

    Join and stretch geom.js
    • CadCraft
    64-bit
  • Stretching an object

    An object with the points inside the stretch window moved and the rest left in place.

    Join and stretch geom.js
    • CadCraft
    64-bit
  • Normal of a grid line

    The unit direction a positive distance moves the grid line in: to the left of its start-to-end direction.

    n = (−Δy, Δx) ÷ L

    Moving a grid line with what hangs on it gridmove.js
    • CadCraft
    64-bit
  • What moves, and by how much

    The new geometry of every object the grid line carries with it.

    tol = max(0.0005 × L, 1e-6); reach = 0.15 × L; move = n × distance

    Moving a grid line with what hangs on it gridmove.js
    • CadCraft
    64-bit
  • Chaining pieces into paths

    Joins line and arc pieces that follow one another into open or closed paths.

    arc → bulge = tan((a1 − a0) ÷ 4); full circle → two half arcs with bulge 1

    Drawing to laser paths laser-cad.js
    • CadCraft
    64-bit
  • A path through a block transform

    A path placed by its block reference, keeping arcs where the transform allows.

    Drawing to laser paths laser-cad.js
    • CadCraft
    64-bit
  • Drawing units to millimeters

    The one scale factor that puts the drawing into millimeters.

    k = millimeters per drawing unit, or 1 when the drawing has no units

    Drawing to laser paths laser-cad.js
    • CadCraft
    64-bit
  • Picture placement

    Where a picture lies on the laser bed and how large it is.

    w = u_x × picture width; h = v_y × picture height, u and v the picture's axes through the transform

    Drawing to laser paths laser-cad.js
    • CadCraft
    64-bit
  • Landing and text start

    Where the landing ends and where the text starts.

    end = last + dir·(landing length, 0); text = end + dir·(gap, 0)

    Multileader geometry leader.js
    • CadCraft
    64-bit
  • Leader line, arrowhead and text

    The polyline, the solid arrowhead and the text a multileader is drawn and exploded as.

    u = (tip − next) ÷ |tip − next|; base = tip − u·a; corners = base ± (−u_y, u_x)·a ÷ 6; text top = landing y + h ÷ 2

    Multileader geometry leader.js
    • CadCraft
    64-bit
  • abs, round, ceil and floor

    The four functions an expression may call.

    round(x) = floor(x + 0.5) for x ≥ 0, −floor(−x + 0.5) for x < 0; ceil(x) = ⌈x − 1e-9·max(1, |x|)⌉; floor(x) = ⌊x + 1e-9·max(1, |x|)⌋

    Arithmetic on typed lengths lencalc.js
    • CadCraft
    • ModelCraft
    • MarkupCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Adding and subtracting

    Sums and differences of lengths, left to right.

    Arithmetic on typed lengths lencalc.js
    • CadCraft
    • ModelCraft
    • MarkupCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Multiplying and dividing

    Products and quotients of a length and plain numbers, left to right.

    Arithmetic on typed lengths lencalc.js
    • CadCraft
    • ModelCraft
    • MarkupCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • The answer

    The final value and whether it is a length or a plain number.

    Arithmetic on typed lengths lencalc.js
    • CadCraft
    • ModelCraft
    • MarkupCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Millimeters per unit

    The table of unit factors.

    in 25.4; ft 304.8; yd 914.4; mi 1 609 344; mil 0.0254; µm 0.001

    Lengths and units for Library items libitem.js
    • CadCraft
    • BimCraft
    Exact
  • Length from text

    A typed or stored length in millimeters.

    with a unit: n × factor; feet and inches: (feet × 12 + inches + a ÷ b) × 25.4; bare number: n × mm per unit

    Lengths and units for Library items libitem.js
    • CadCraft
    • BimCraft
    64-bit
  • Drawing units

    The millimeters per drawing unit of a DWG or DXF file.

    Lengths and units for Library items libitem.js
    • CadCraft
    • BimCraft
    Exact
  • Pipe size in eighths of an inch

    A decimal inch size written as a fraction, such as 1 1/2".

    eighths = round((n − ⌊n⌋) × 8)

    Lengths and units for Library items libitem.js
    • CadCraft
    • BimCraft
    64-bit
  • Size label on the preview

    The overall width and depth printed on an item's preview picture.

    millimeters: round(mm); inches: round(mm ÷ 25.4 × 8) eighths

    Lengths and units for Library items libitem.js
    • CadCraft
    • BimCraft
    64-bit
  • Millimeters to drawing units

    The factor that puts an item's millimeters into the drawing's units.

    k = 1 ÷ (mm per drawing unit), or 1 when the drawing has no units

    Library item placed as a block libplace.js
    • CadCraft
    64-bit
  • Plan entities in drawing units

    Each line, circle, arc, polyline, ellipse, text, point and hatch of the item as a drawing object.

    length × k; angle in degrees × π ÷ 180, reduced to [0, 2π)

    Library item placed as a block libplace.js
    • CadCraft
    64-bit
  • Size attributes

    The width, depth, height and weight written as attributes on the block.

    Library item placed as a block libplace.js
    • CadCraft
    64-bit
  • Count and quantity of each item

    How many times each Library item is placed and the total of their quantities, for the credits and schedule.

    placed = number of references; quantity = Σ parseFloat(quantity attribute), 1 when not above 0

    Library item placed as a block libplace.js
    • CadCraft
    64-bit
  • Pattern in drawing units

    The dash and gap lengths of a linetype for this drawing.

    metric drawing: inch pattern × 25.4

    Linetype dashes linetypes.js
    • CadCraft
    64-bit
  • Dashes along lines and arcs

    The pieces of each line or arc that are drawn.

    piece from fraction s ÷ length to (s + step) ÷ length; arc length = r × sweep

    Linetype dashes linetypes.js
    • CadCraft
    64-bit
  • Local placement record

    The scale, rotation and point pair that tie drawing coordinates to grid coordinates.

    scale = m per drawing unit ÷ m per grid unit; from = (x, y); to = (e, n)

    Drawing placed on a map grid maplayers.js
    • CadCraft
    • BimCraft
    64-bit
  • Axes of an object's own coordinate system

    The X, Y and Z axes of the plane an object was drawn on, from its extrusion direction.

    Z = N ÷ |N|; X = (Wy × Z or Wz × Z) ÷ length; Y = Z × X

    Objects on a tilted or flipped plane mapped to the plan ocs.js
    • CadCraft
    64-bit
  • Is the plane the drawing's own

    Whether an extrusion direction is straight up, so that nothing needs mapping.

    Objects on a tilted or flipped plane mapped to the plan ocs.js
    • CadCraft
    64-bit
  • Plane to plan matrix

    The transform from an object's own (x, y) at its elevation to the plan.

    M = [X.x, X.y, Y.x, Y.y, Z.x·elevation, Z.y·elevation]

    Objects on a tilted or flipped plane mapped to the plan ocs.js
    • CadCraft
    64-bit
  • Mapped circle, arc or ellipse

    The circle, arc or ellipse that has exactly the points of the original after the map.

    t* = ½·atan2(2 u·v, |u|² − |v|²); U = u·cos t* + v·sin t*; V = −u·sin t* + v·cos t*; a = |U|, b = |V|

    Objects on a tilted or flipped plane mapped to the plan ocs.js
    • CadCraft
    64-bit
  • Polyline arcs as points

    A polyline's arc segments as points, for a map that does not keep shapes.

    k = max(4, ⌈64 × |sweep| ÷ 2π⌉); point = c + r·(cos a, sin a)

    Objects on a tilted or flipped plane mapped to the plan ocs.js
    • CadCraft
    64-bit
  • Mapping each kind of object

    A drawing object in its own coordinate system put through the plane's matrix.

    text: rotation = atan2(M·d); height × |M·d × M·up| ÷ |M·d|; block: scales and rotation read from the mapped axes

    Objects on a tilted or flipped plane mapped to the plan ocs.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.