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

  • Surface from given triangles

    Builds a surface from vertices and faces read from a file, keeping every triangle counter-clockwise.

    o = (x_b − x_a)(y_c − y_a) − (y_b − y_a)(x_c − x_a); swap b, c when o < 0

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Crossing of two breakline segments

    Finds where two segments properly cross, as a fraction along each.

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

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Vertex at a breakline crossing

    Places a new vertex where two breaklines cross and gives it an elevation.

    x = x_a + (x_b − x_a) t; z from the first breakline

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Side of a breakline a vertex is on

    Decides whether a vertex lies left of, right of, or on the line of a breakline being forced in.

    on the line when |orient| ÷ L < 1e-7 × (1 + L)

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Whether a diagonal can be flipped

    Tests that the two triangles on an edge form a strictly convex quadrilateral.

    orient(c, d, a) and orient(c, d, b) have opposite signs

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    Exact
  • Whether an edge crosses a breakline

    Tests whether two segments properly cross during the flips that force a breakline in.

    each segment's ends lie on opposite sides of the other

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    Exact
  • Long outer triangles removed

    Removes triangles on the outside whose outer edge is longer than a limit, working inward.

    remove when outer edge length > maxEdge

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Contour lines

    The contour lines of the surface at every multiple of an interval.

    level = base + k × interval; t = (L − zᵢ) ÷ (zⱼ − zᵢ); point = pᵢ + (pⱼ − pᵢ) t

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Triangle clipped at an elevation

    Keeps the part of a triangle above or below a level, for the elevation bands.

    t = f_p ÷ (f_p − f_q); new point = p + (q − p) t at z = L

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Convex hull

    The convex hull of a set of points, counter-clockwise.

    monotone chain; pop while cross(o, a, b) ≤ 0

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Polygon area

    The signed area of a polygon.

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

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Point inside a polygon

    Tests whether a point is inside a polygon.

    count crossings of a ray to the right; odd = inside

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Polygon clipped by a convex polygon

    Clips a polygon to a convex polygon, used to keep a boundary inside the data's hull.

    inside when cross(b − a, p − a) ≥ −1e-9; t = cross(a − p, e) ÷ cross(d, e)

    Ground surface triangulation and contours tin.js
    • BimCraft
    • CivilCraft
    64-bit
  • Corners and edges an element offers to Measure

    Collects an element's feature edges and corners in world space for the pointer to snap to.

    p_world = M × p_local; corners merged by round(coordinate × 1e4)

    Points and faces picked for 3D measuring viewer3d.js
    • BimCraft
    32-bit in part
  • Area of the face under the pointer

    The area of the flat face the pointer is on, in world units.

    area = region area × |det M|^(2 ÷ 3)

    Points and faces picked for 3D measuring viewer3d.js
    • BimCraft
    32-bit in part
  • Bounding box of each element

    The world-space box of each element, over every loaded model.

    box = M × (min, max of the element's vertices)

    Points and faces picked for 3D measuring viewer3d.js
    • BimCraft
    32-bit in part
  • Clipping planes of a section box

    Turns each section cell's planes into the viewer's clipping planes and draws the cell's frame a hair inside it.

    viewer normal = turn(−n_x, −n_z, n_y); frame inset = Σ sizes × 1e-5 + 1e-4

    3D view drawing viewer3d.js
    • BimCraft
    32-bit, display only
  • Section frame turned with the building

    Rotates a viewer point about the vertical through the model's center into the section frame.

    x′ = c_x + x cos a + z sin a; z′ = c_z − x sin a + z cos a

    3D view drawing viewer3d.js
    • BimCraft
    32-bit, display only
  • Model bounds in the section frame

    The bounds of every drawn vertex in the turned section frame.

    box = min and max of turned vertex positions

    3D view drawing viewer3d.js
    • BimCraft
    32-bit, display only
  • Polygon clipped at a station or an offset

    Cuts a wall outline at an opening's edge or at a layer boundary.

    t = (at − a) ÷ (b − a); new point has the clip coordinate exactly

    Wall layers drawn in plans and sections wall-plan-graphics.js
    • BimCraft
    64-bit
  • Layer bands across a wall in plan

    The band of each wall layer across the wall, from the exterior face inward.

    off₀ = ±t ÷ 2; offᵢ₊₁ = offᵢ ∓ tᵢ

    Wall layers drawn in plans and sections wall-plan-graphics.js
    • BimCraft
    64-bit
  • Layer thicknesses against the wall thickness

    Checks that a wall's layers add up to its thickness before any layer is drawn.

    |Σ tᵢ − t| ≤ 0.005 mm

    Wall layers drawn in plans and sections wall-plan-graphics.js
    • BimCraft
    64-bit
  • Curved wall outlines as chords

    Maps a path from the wall's frame back to the plan, adding points along a curved wall so the chords stay close to the arc.

    step = 2 acos(max(−1, 1 − 0.002 ÷ radius)); n = ⌈|Δstation| ÷ R ÷ step⌉

    Wall layers drawn in plans and sections wall-plan-graphics.js
    • BimCraft
    64-bit
  • Boundary lines between layers

    Finds the stretches of a layer boundary that lie inside the wall's outline.

    x = x_a + (x_b − x_a) × (offset − y_a) ÷ (y_b − y_a)

    Wall layers drawn in plans and sections wall-plan-graphics.js
    • BimCraft
    64-bit
  • Outline of joined wall pieces

    Finds the outer edges of wall pieces that touch, so shared edges inside a joint are not drawn.

    t = cross(c − a, v) ÷ cross(d, v); parallel when |cross(d, v)| < 1e-12 × |d| × |v|

    Wall layers drawn in plans and sections wall-plan-graphics.js
    • BimCraft
    64-bit
  • Building width on an elevation

    The overall width of the building's walls across a view direction, for the width note on an elevation.

    x = p · right ± |n · right| × t ÷ 2 over every wall end

    Wall layers drawn in plans and sections wall-section-graphics.js
    • BimCraft
    64-bit
  • Wall and opening edges for an elevation

    The edges of a straight wall's two faces, its ends and its openings, handed to the hidden-line view.

    P(s, t, h) = a + u s + n t at height h

    Wall layers drawn in plans and sections wall-section-graphics.js
    • BimCraft
    64-bit
  • Walls of every level in one level's axes

    Moves every wall and opening into one level's plan and height, for a section through several levels.

    T = inverse(level) × level_wall; a′ = T a; z = T₁₄ + base offset

    Wall layers drawn in plans and sections wall-section-graphics.js
    • BimCraft
    64-bit
  • Where a section cuts a wall

    The station along a wall at which the section plane cuts it, when the cut is square to the wall.

    s = ((o − a) · dir) ÷ (u · dir)

    Wall layers drawn in plans and sections wall-section-graphics.js
    • BimCraft
    64-bit
  • Layer bands in a section cut

    The rectangle of each wall layer in a section, between the heights the openings leave.

    x = c + off × (n · right); offᵢ₊₁ = offᵢ ∓ tᵢ

    Wall layers drawn in plans and sections wall-section-graphics.js
    • BimCraft
    64-bit
  • Solid of revolution

    Turns a profile of radius and height points into a closed triangle mesh about the vertical axis.

    vertex = (r × cos(2π i ÷ 24), r × sin(2π i ÷ 24), z), i = 0 … 23

    Plant equipment solids, capacity and placement addons/plant/lib/equip.js
    • BimCraft
    64-bit
  • Elliptical head profile

    The outline of a 2:1 elliptical vessel head from the tangent line to the pole.

    (r × cos a, z₀ ± (r ÷ 2) × sin a), a = (π ÷ 2) × i ÷ 6

    Plant equipment solids, capacity and placement addons/plant/lib/equip.js
    • BimCraft
    64-bit
  • Vessel capacity

    The capacity in cubic meters of a vessel or column: a cylinder and two 2:1 elliptical heads.

    V = (π (d ÷ 2)² L + (4 ÷ 3) π (d ÷ 2)² (d ÷ 4)) ÷ 10⁹

    Plant equipment solids, capacity and placement addons/plant/lib/equip.js
    • BimCraft
    64-bit
  • Tank capacity

    The capacity in cubic meters of an atmospheric tank.

    V = π r² h ÷ 10⁹

    Plant equipment solids, capacity and placement addons/plant/lib/equip.js
    • BimCraft
    64-bit
  • Signed volume of a mesh

    The volume enclosed by a triangle mesh in cubic millimeters, positive when the triangles face outward.

    V = Σ p · (q × r) ÷ 6 over the triangles

    Plant equipment solids, capacity and placement addons/plant/lib/equip.js
    • BimCraft
    64-bit
  • Dimensions accepted for a piece of equipment

    Takes the dimensions a person typed, builds the solids and returns their bounding box, nozzles and capacity.

    Plant equipment solids, capacity and placement addons/plant/lib/equip.js
    • BimCraft
    64-bit
  • Equipment moved and turned

    Moves a piece of equipment to a point and turns it about the vertical axis by an angle in degrees.

    (x', y') = (x₀ + x cos a − y sin a, y₀ + x sin a + y cos a), a = rot × π ÷ 180

    Plant equipment solids, capacity and placement addons/plant/lib/equip.js
    • BimCraft
    64-bit
  • Zone solid in millimeters

    Turns a hazard or consequence zone given in meters into a closed solid in millimeters for the model.

    vertex (mm) = vertex (m) × 1000

    Plant equipment solids, capacity and placement addons/plant/lib/engineering.js
    • BimCraft
    64-bit
  • Pipe run handed to the pipe stress input

    Takes the model's pipe run with the most points and gives its points and total length to the pipe stress calculator.

    length = Σ √(Δx² + Δy² + Δz²) over the legs

    Plant equipment solids, capacity and placement addons/plant/lib/engineering.js
    • BimCraft
    64-bit
  • Nozzle port size

    The outside diameter in millimeters stored on a nozzle's port, from its nominal pipe size.

    size = round(od (in) × 25.4 × 10) ÷ 10

    Plant equipment solids, capacity and placement addons/plant/lib/place.js
    • BimCraft
    64-bit
  • Capacity property in the model

    The capacity in cubic meters written to the CadCraft_Plant property set of the placed equipment.

    CapacityM3 = round(V × 1000) ÷ 1000

    Plant equipment solids, capacity and placement addons/plant/lib/place.js
    • BimCraft
    64-bit
  • Number written to the file

    Formats a coordinate, direction component or property value as STEP text.

    num(v) = round(v × 10⁴) ÷ 10⁴

    Plant equipment written as an IFC file addons/plant/lib/ifc-out.js
    • BimCraft
    64-bit
  • Placement of an item

    The position and the turn about the vertical axis of a piece of equipment in the file.

    X direction = (cos a, sin a, 0), a = rot × π ÷ 180

    Plant equipment written as an IFC file addons/plant/lib/ifc-out.js
    • BimCraft
    64-bit
  • Reference direction of a nozzle port

    A unit vector square to a nozzle's outward direction, used as the X axis of the port's placement.

    x = (d × a) ÷ |d × a|, a = (1, 0, 0) or (0, 1, 0)

    Plant equipment written as an IFC file addons/plant/lib/ifc-out.js
    • BimCraft
    64-bit
  • Capacity property

    The capacity in cubic meters written to the CadCraft_Plant property set.

    CapacityM3 = round(V × 1000) ÷ 1000

    Plant equipment written as an IFC file addons/plant/lib/ifc-out.js
    • BimCraft
    64-bit
  • Isometric projection

    The position on the drawing of a 3D point, before fitting to the sheet.

    u = (x − y) × cos 30°; v = z + (x + y) × 0.5

    Piping isometric drawing and its bill of materials addons/plant/lib/iso.js
    • BimCraft
    64-bit
  • Length text

    Turns a length in millimeters into the text on the drawing: whole millimeters, or feet and inches to 1/8 inch.

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

    Piping isometric drawing and its bill of materials addons/plant/lib/iso.js
    • BimCraft
    64-bit
  • Point at a distance along a run

    The 3D point and direction at a given distance along a pipe run, used to place valves and spool balloons.

    Piping isometric drawing and its bill of materials addons/plant/lib/iso.js
    • BimCraft
    64-bit
  • Bill of materials quantities

    Pipe length per size and spec, the count of elbows by angle, valves and welds.

    pipe = Σ leg lengths; elbow angle = round(acos(u · v ÷ (|u| |v|)) × 180 ÷ π); welds = 2 × bends + 2 × valves

    Piping isometric drawing and its bill of materials addons/plant/lib/iso.js
    • BimCraft
    64-bit
  • Fit to the sheet

    The single scale and offset that place the projected runs inside the drawing area of the sheet.

    scale = min(availW ÷ bw, availH ÷ bh)

    Piping isometric drawing and its bill of materials addons/plant/lib/iso.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.