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

  • Polygon area

    The signed plan area of a polygon.

    A = ½ Σ (xᵢ yᵢ₊₁ − xᵢ₊₁ yᵢ)

    Roof faces, ridges and areas from an outline addons/trusscraft/lib/bim/res-skeleton.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Distance from a point to a segment

    The shortest distance from a plan point to a segment.

    t = clamp((p − a)·d ÷ |d|², 0, 1); distance = |p − a − d t|

    Roof faces, ridges and areas from an outline addons/trusscraft/lib/bim/res-roofplan.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Eave line and edge speeds

    Moves each wall line out to the eave and sets how fast and from what height each roof edge rises.

    out = overhang − fascia thickness; speed = 1 ÷ tan(pitch); start = plate − out × tan(pitch)

    Roof faces, ridges and areas from an outline addons/trusscraft/lib/bim/res-roofplan.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Slope and pitch of each face

    The slope and the pitch in degrees stored on each roof face.

    slope = 1 ÷ speed; pitch = atan(1 ÷ speed) in degrees

    Roof faces, ridges and areas from an outline addons/trusscraft/lib/bim/res-roofplan.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Ridge, hip or valley

    Decides what each roof line is and measures its length.

    len = √(Δx² + Δy² + Δz²)

    Roof faces, ridges and areas from an outline addons/trusscraft/lib/bim/res-roofplan.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Eave and rake edges

    Finds the face edges that lie on the eave line, tells level eaves from sloped rakes, and measures them.

    top height = face height + thickness ÷ cos(pitch)

    Roof faces, ridges and areas from an outline addons/trusscraft/lib/bim/res-roofplan.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Soffit height

    The level of the soffit under each pitched eave.

    z_eave = plate − out × tan(pitch); z = min(z_eave, z_eave + thickness ÷ cos(pitch) − fascia)

    Roof faces, ridges and areas from an outline addons/trusscraft/lib/bim/res-roofplan.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Roof area and line totals

    The roof's sloped area, its plan area, and the total length of ridges, hips, valleys, eaves and rakes.

    area = Σ |plan area of face| ÷ cos(pitch)

    Roof faces, ridges and areas from an outline addons/trusscraft/lib/bim/res-roofplan.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Outline moved out by the overhangs

    The polygon with each edge moved out by its own distance.

    corner = p₀ + u_prev × ((p₁ − p₀) × u) ÷ (u_prev × u)

    Roof faces, ridges and areas from an outline addons/trusscraft/lib/bim/res-roofplan.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Eave line crosses itself

    Checks that the eave polygon does not cross itself and runs anticlockwise.

    Roof faces, ridges and areas from an outline addons/trusscraft/lib/bim/res-roofplan.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Roof height over a point

    The height of the roof's underside above a plan point.

    Roof faces, ridges and areas from an outline addons/trusscraft/lib/bim/res-roofplan.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Edges split where they cross or overlap

    Finds where two wall edges cross, touch or run along each other.

    t = (c − a) × s ÷ (r × s); u = (c − a) × r ÷ (r × s)

    Rooms and building outline from walls addons/trusscraft/lib/bim/model-rooms.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Points matched on a grid

    Decides when two split points are the same point.

    key = (round(x ÷ 0.001), round(y ÷ 0.001))

    Rooms and building outline from walls addons/trusscraft/lib/bim/model-rooms.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Boundary pieces

    Keeps the pieces that have a wall on one side and open space on the other.

    test points = middle ± n × min(0.5, length ÷ 4)

    Rooms and building outline from walls addons/trusscraft/lib/bim/model-rooms.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Next piece at a joint

    Chooses which boundary piece a loop follows where several meet.

    a = (angle back − angle of piece), brought into (0, 2π]

    Rooms and building outline from walls addons/trusscraft/lib/bim/model-rooms.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Room area and perimeter

    Tells rooms from islands and gives each room its net area and full perimeter.

    area = loop area − Σ hole areas; perimeter = loop + Σ hole perimeters

    Rooms and building outline from walls addons/trusscraft/lib/bim/model-rooms.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Polygon area

    The signed area of a loop.

    A = ½ Σ (xᵢ yᵢ₊₁ − xᵢ₊₁ yᵢ)

    Rooms and building outline from walls addons/trusscraft/lib/bim/model-rooms.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Polygon perimeter

    The length round a loop.

    P = Σ √(Δx² + Δy²)

    Rooms and building outline from walls addons/trusscraft/lib/bim/model-rooms.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Polygon centroid

    The center of area of a loop.

    C = Σ (a + b)(a × b) ÷ (3 Σ a × b)

    Rooms and building outline from walls addons/trusscraft/lib/bim/model-rooms.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Label point inside a room

    A point well inside a room for its label.

    Rooms and building outline from walls addons/trusscraft/lib/bim/model-rooms.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Point inside a polygon

    Tests whether a plan point lies inside a polygon.

    Rooms and building outline from walls addons/trusscraft/lib/bim/model-rooms.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Repeated and collinear points removed

    Tidies a loop before its area is taken.

    collinear when |ab × bc| ≤ 1e-7 × (|ab| |bc| + 1e-12)

    Rooms and building outline from walls addons/trusscraft/lib/bim/model-rooms.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Guard on every written measure

    Decides what is written when a value is missing or not a number.

    DWG object values written and read dwg/objects-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Arc angles brought into one turn

    Brings an angle into the range from 0 up to 2π before it is written.

    r = a mod 2π; r + 2π when r < 0

    DWG object values written and read dwg/objects-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Arc

    Writes an arc's center, radius and two angles.

    DWG object values written and read dwg/objects-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Line

    Writes a line's two end points.

    DWG object values written and read dwg/objects-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Polyline vertices

    Writes the vertices of a lightweight polyline.

    DWG object values written and read dwg/objects-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Vertex widths

    Writes the start and end width at a polyline vertex.

    equal widths: one value, −|width|

    DWG object values written and read dwg/objects-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Linetype pattern length

    The total length of a linetype's dash pattern.

    length = Σ |element length|

    DWG object values written and read dwg/objects-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Text direction

    The x-axis direction written for a block of text.

    x axis = (cos θ, sin θ, 0)

    DWG object values written and read dwg/objects-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Block scale

    Writes the three scale factors of a block reference in the format's compact form.

    DWG object values written and read dwg/objects-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Single-line text

    Writes a text's insertion point, height, rotation, width factor and oblique angle.

    DWG object values written and read dwg/objects-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Extension record values

    Writes the numbers kept in an extension record.

    DWG object values written and read dwg/objects-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Block content matrix of a multileader

    The 4 × 4 matrix written for a multileader's block content when the model gives none.

    M = translate(l) · rotate_z(θ) · scale(s)

    DWG object values written and read dwg/mleader-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Line read

    Reads a line's two end points.

    DWG object values written and read dwg/objects-read.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Polyline vertices read

    Reads the vertices of a lightweight polyline.

    DWG object values written and read dwg/objects-read.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • North direction of older geolocation data

    Turns the north angle of a version 1 geolocation object into a direction vector.

    north = (sin a, cos a)

    DWG object values written and read dwg/objects-read.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Fit point parameters and knots

    The parameter of each fit point along the spline, and the knot vector built from them.

    u₀ = 0; uᵢ = uᵢ₋₁ + |Qᵢ − Qᵢ₋₁|; knots = [0,0,0,0, u₁ … uₙ₋₂, L,L,L,L]

    Spline through fit points dwg/spline-fit.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    64-bit
  • Cubic basis functions at a parameter

    The four B-spline basis values that weigh the control points at one fit point.

    Cox–de Boor recurrence, degree 3

    Spline through fit points dwg/spline-fit.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    64-bit
  • Start condition

    The rows that pin the first control point and set the spline's start tangent or a natural start.

    P₀ = Q₀; P₁ − P₀ = T₀ × u₄ ÷ 3 or P₀ ÷ u₄ − P₁ (1 ÷ u₄ + 1 ÷ u₅) + P₂ ÷ u₅ = 0

    Spline through fit points dwg/spline-fit.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    64-bit
  • End condition

    The rows that pin the last control point and set the spline's end tangent or a natural end.

    Pₘ₋₁ = Qₙ₋₁; Pₘ₋₁ − Pₘ₋₂ = T₁ × (L − uₘ₋₁) ÷ 3 or the zero second derivative row

    Spline through fit points dwg/spline-fit.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    64-bit
  • Solve for the control points

    Solves the banded system for the x, y and z of every control point.

    A · P = B

    Spline through fit points dwg/spline-fit.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    64-bit
  • Lineweight to the file's lineweight index

    Picks the stored lineweight that is nearest to the one the layer or object has.

    index = the i with the smallest |table[i] − lineweight|

    Values changed when a DWG is written dwg/write.js
    • CadCraft
    • ModelCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    Exact
  • Ellipse with a ratio above 1

    Rewrites an ellipse whose minor axis is longer than its major axis so the file holds a ratio of 1 or less.

    major′ = (−m_y, m_x) × ratio; ratio′ = 1 ÷ ratio; start and end − π ÷ 2

    Values changed when a DWG is written dwg/write.js
    • CadCraft
    • ModelCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Ray and construction line direction

    Writes the direction of a ray or construction line as a unit vector.

    d′ = d ÷ |d|

    Values changed when a DWG is written dwg/write.js
    • CadCraft
    • ModelCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Drawing extents

    The lower left and upper right corner of model space written to the file header.

    min and max of x, y, z over the defining points

    Values changed when a DWG is written dwg/write.js
    • CadCraft
    • ModelCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Default angles of a light

    The hotspot and falloff angles written for a light that has none of its own.

    hotspot = π ÷ 4; falloff = π ÷ 4 + 0.0872664626

    Values changed when a DWG is written dwg/solid-write.js
    • CadCraft
    • ModelCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Plane of a face

    The plane a face lies in, as a unit normal and a distance from the origin.

    n = Newell normal of the outer loop; d = n · p₀

    Face planes, areas, triangles and solid volume m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Area of a face

    The area of a face, holes taken out.

    area = |Σ (pᵢ × pᵢ₊₁)| ÷ 2 for the outer loop, minus the same for each hole

    Face planes, areas, triangles and solid volume m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Triangles of a face

    The triangles a face is cut into for volume, export and ray tests.

    Face planes, areas, triangles and solid volume m3d/model.js
    • CadCraft
    • ModelCraft
    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.