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

  • Is the item big enough

    Refuses a hatch with fewer than 3 corners or under 100 mm², and a line under 10 mm.

    L = Σ √(Δx² + Δy²); refuse when L < 10 mm or |area| < 100 mm²

    Drafting lines and hatch regions drafting.js
    • BimCraft
    64-bit
  • Move drafting items

    Every point of the picked items moved by one offset.

    (x, y) → (x + dx, y + dy)

    Drafting lines and hatch regions drafting.js
    • BimCraft
    64-bit
  • Is a point inside the region

    Whether a point lies inside the outline and outside its holes.

    even-odd count of edges crossed by a ray toward +x

    Drafting lines and hatch regions drafting.js
    • BimCraft
    64-bit
  • Clip a stroke to the region

    The pieces of a straight stroke that lie inside the region.

    t = ((c − a) × e) ÷ (d × e), u = ((c − a) × d) ÷ (d × e); keep 0 < t < 1, 0 ≤ u ≤ 1

    Drafting lines and hatch regions drafting.js
    • BimCraft
    64-bit
  • Strokes of a hatch pattern

    The lines, dots or zigzags of a pattern inside a region, at its scale.

    line k of a family: n · p = ⌊(n_min − offset) ÷ gap⌋ × gap + k × gap, gap = pattern gap × scale

    Drafting lines and hatch regions drafting.js
    • BimCraft
    64-bit
  • Pattern scale

    The scale of a hatch pattern as it is kept.

    scale = min(50, max(0.1, v)), or 1 when v is not a positive number

    Drafting lines and hatch regions drafting.js
    • BimCraft
    64-bit
  • A typed point

    The next point of a drafting line from typed coordinates, a typed offset, a typed length and angle, or a typed length along the pointer's direction.

    polar: (x + L·cos(a·π ÷ 180), y + L·sin(a·π ÷ 180)); length only: last + L × (to − last) ÷ |to − last|

    Drafting lines and hatch regions drafting-ui.js
    • BimCraft
    64-bit
  • Combine two transforms

    The product of two plan transforms, each six numbers.

    [a b c d e f]: x′ = a·x + c·y + e, y′ = b·x + d·y + f

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Block insert transform

    Where the content of a block lands: insertion point, rotation, scale, base point and its place in a row and column array.

    M = T(insert) · R(rotation) · S(sx, sy) · T(−base + (col × colSpacing ÷ sx, row × rowSpacing ÷ sy))

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Tilted block seen from above

    The plan transform of an insert whose extrusion direction is neither up nor down.

    Ax = unit(Wz × N) (or Wy × N when |Nx| and |Ny| < 1/64); Ay = unit(N × Ax); offset = N·z

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Downward extrusion

    Mirrors an entity in X when its extrusion direction points down.

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Transform points

    A list of points moved through a transform into the space's coordinates.

    x′ = a·x + c·y + e; y′ = b·x + d·y + f

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Segments in an arc

    How many straight segments stand in for an arc.

    n = max(8, min(128, ⌈|sweep| ÷ 2π × 72⌉))

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Points along an arc or circle

    An arc or circle as points on it.

    pᵢ = (cx + r·cos aᵢ, cy + r·sin aᵢ), aᵢ = a₀ ± sweep × i ÷ n

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Points along an ellipse

    An ellipse or elliptical arc as points on it.

    p(t) = c + R(rot) · (L·cos t, L·ratio·sin t), L = |major axis|, rot = atan2(my, mx)

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Polyline with bulge arcs

    A polyline whose segments may be arcs, as points.

    θ = 4·atan(bulge); r = chord ÷ (2·sin(θ ÷ 2)); center = chord middle + normal × r·cos(θ ÷ 2)

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Points along a spline

    A spline as points: its fit points, or samples of the B-spline from its control points.

    de Boor: dⱼ = (1 − a)·dⱼ₋₁ + a·dⱼ, a = (u − kᵢ) ÷ (kᵢ₊ₚ₋ᵣ₊₁ − kᵢ); point = (Σ w·P) ÷ Σ w

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • What a sheet viewport looks at

    The model point at the middle of a viewport on a sheet.

    vx = target_x + cos(tw)·cx + sin(tw)·cy; vy = target_y − sin(tw)·cx + cos(tw)·cy

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • A viewport's window on the model

    The box in model space that a viewport shows, used to say when it looks at nothing.

    half width = w ÷ 2 × viewHeight ÷ h; half height = viewHeight ÷ 2; corners turned by the twist

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Picture placement

    The transform from a picture's pixels to drawing coordinates.

    world = P + u·px − v·py + v·h (pixel y runs down; P is the lower left corner)

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Lines of a paragraph of text

    Where each line of a multi-line text starts.

    pitch = h × 1.667 × line spacing; line i at insert + (top − pitch × i) along the up direction

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Text position, height and angle

    One line of text carried through the entity's transform.

    H = h × |second column of M|; angle = atan2(m₁, m₀) ± rotation (− when M mirrors)

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Paper unit of a sheet

    Whether a sheet is in inches or millimeters.

    unit = mm when the sheet is wider than 100 units, else inches

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Line weight in millimeters

    A stored line weight, in hundredths of a millimeter, as millimeters.

    mm = v ÷ 100 for 0 ≤ v ≤ 211, else 0.25

    DWG and DXF drawings compiled for the plan view dwg-compile.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Pointer position in drawing coordinates

    The drawing coordinates under the pointer, for the coordinate readout.

    x = cx + (px − W ÷ 2) ÷ zoom; y = cy − (py − H ÷ 2) ÷ zoom

    DWG and DXF drawings compiled for the plan view dwg-view.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Model to sheet through a viewport

    The transform that carries a model point onto the sheet through one viewport.

    k = h ÷ viewHeight; paper = center + k · R(twist) · (model − view point)

    DWG and DXF drawings compiled for the plan view dwg-view.js
    • BimCraft
    • TakeoffCraft
    64-bit
  • Millimeters per paper unit

    The size of one paper unit of a sheet in millimeters, for line weights.

    1 for millimeters, 25.4 for inches

    DWG and DXF drawings compiled for the plan view dwg-view.js
    • BimCraft
    • TakeoffCraft
    Exact
  • Combine two 3D transforms

    The product of two 3 × 4 transforms.

    DWG and DXF drawings in 3D dwg-compile3d.js
    • BimCraft
    64-bit
  • Transform a point

    A point carried through a 3 × 4 transform.

    x′ = m₀·x + m₁·y + m₂·z + m₃ (and the same for y′, z′)

    DWG and DXF drawings in 3D dwg-compile3d.js
    • BimCraft
    64-bit
  • Extrusion direction

    The unit extrusion direction of an entity, or straight up when it has none.

    N = (x, y, z) ÷ √(x² + y² + z²)

    DWG and DXF drawings in 3D dwg-compile3d.js
    • BimCraft
    64-bit
  • Object coordinate system

    The transform from an entity's own plane to world coordinates.

    Ax = unit(Wz × N) (or Wy × N when |Nx| and |Ny| < 1/64); Ay = unit(N × Ax); columns Ax, Ay, N

    DWG and DXF drawings in 3D dwg-compile3d.js
    • BimCraft
    64-bit
  • Thickness vector

    The offset between the bottom and top of an entity that has thickness.

    up = M · (N × thickness), without the translation

    DWG and DXF drawings in 3D dwg-compile3d.js
    • BimCraft
    64-bit
  • Block insert transform in 3D

    Where the content of a block lands in 3D, with rows and columns.

    M = OCS · T(insert) · Rz(rotation) · T(col × colSpacing, row × rowSpacing, 0) · S(sx, sy, sz) · T(−base)

    DWG and DXF drawings in 3D dwg-compile3d.js
    • BimCraft
    64-bit
  • Ellipse in 3D

    An ellipse or elliptical arc as 3D points.

    minor = (N × major) × ratio; p(t) = c + cos t · major + sin t · minor

    DWG and DXF drawings in 3D dwg-compile3d.js
    • BimCraft
    64-bit
  • Half width of a wide polyline

    The offset to each side of a polyline that has a start and end width.

    w(k) = (sw + (ew − sw) × length so far ÷ segment length) ÷ 2, along the normal of the path at k

    DWG and DXF drawings in 3D dwg-compile3d.js
    • BimCraft
    64-bit
  • Spline in 3D

    A spline as 3D points: its fit points, or samples of the B-spline from its control points.

    de Boor on (w·x, w·y, w·z, w); point = (Σ w·P) ÷ Σ w

    DWG and DXF drawings in 3D dwg-compile3d.js
    • BimCraft
    64-bit
  • Extents of the drawing

    The smallest box round everything drawn, in drawing units.

    DWG and DXF drawings in 3D dwg-compile3d.js
    • BimCraft
    64-bit
  • Section plane offset

    Where a section plane cuts the drawing, from a typed offset in drawing units.

    at = lo + clamp(offset × s, 0, hi − lo); offset shown = (at − lo) ÷ s, s = 100 ÷ largest extent

    DWG and DXF drawings in 3D dwg-view3d.js
    • BimCraft
    64-bit
  • Section range

    The largest offset a section plane can take along an axis, in drawing units.

    size = (max − min) ÷ s

    DWG and DXF drawings in 3D dwg-view3d.js
    • BimCraft
    64-bit
  • Drawing coordinates to scene coordinates

    The positions sent to the GPU: centered on the drawing and scaled to about 100 units across.

    scene = (p − center) × 100 ÷ largest extent

    DWG and DXF views on screen dwg-view3d.js
    • BimCraft
    32-bit, display only
  • Nearest line to the pointer

    The distance in pixels from the pointer to a line, for picking.

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

    DWG and DXF views on screen dwg-view3d.js
    • BimCraft
    32-bit, display only
  • Zoom to the drawing

    The zoom and center that show the whole drawing or sheet.

    zoom = min(W ÷ w, H ÷ h) × 0.92; center = middle of the bounds

    DWG and DXF views on screen dwg-view.js
    • BimCraft
    32-bit, display only
  • Viewport windows on the model

    For each sheet viewport, the half width and half height of the model area it shows.

    k = h ÷ viewHeight; half width = w ÷ 2 ÷ k; half height = h ÷ 2 ÷ k

    Equipment list from drawing tags dwg-equipment.js
    • BimCraft
    64-bit
  • Sheets that show a point

    Which sheets show a given model point.

    u = dx·cos − dy·sin, v = dx·sin + dy·cos; inside when |u| ≤ half width and |v| ≤ half height

    Equipment list from drawing tags dwg-equipment.js
    • BimCraft
    64-bit
  • Quantity of a row

    The scheduled quantity of an item tagged in several places.

    qty = Σ tag quantities

    Equipment list from drawing tags dwg-equipment.js
    • BimCraft
    64-bit
  • Heat capacity of air per volume

    The energy to warm one cubic meter of air by one kelvin, in watt-hours.

    ρ·c = 1.2 kg/m³ × 1005 J/kgK ÷ 3600 = 0.335 Wh/m³K

    Heating and cooling loads per room energy-bim.js
    • BimCraft
    64-bit
  • Does a ray reach a box

    Whether a ray passes through an element's bounding box within its reach.

    Heating and cooling loads per room energy-bim.js
    • BimCraft
    64-bit
  • Where a ray crosses triangles

    Every distance along a ray at which it crosses a triangle of an element.

    det = e₁ · (d × e₂); u = (t · (d × e₂)) ÷ det; v = (d · (t × e₁)) ÷ det; distance = (e₂ · (t × e₁)) ÷ det

    Heating and cooling loads per room energy-bim.js
    • BimCraft
    64-bit
  • Is a point inside a room

    Whether a point lies inside the closed shell of a space.

    inside when a slanted ray crosses the shell an odd number of times

    Heating and cooling loads per room energy-bim.js
    • BimCraft
    64-bit
  • Room volume

    The volume enclosed by a room's triangles.

    V = |Σ a · (b × c)| ÷ 6 over the triangles

    Heating and cooling loads per room energy-bim.js
    • BimCraft
    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.