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.
Calculations
-
Stair from a sketched walking line
Turns a walking line of one, two or three segments into a straight, L or U stair: its direction, width, gap, split and tread depth.
n = max(2, ⌈H ÷ riser_max − 1e-9⌉); tread = max(50, line length ÷ (n − 1)); split = first leg ÷ total
Stair risers, treads and stairwell stair-sketch.js64-bit- BimCraft
-
Roof plane area in Properties
The sloped area of a manual roof plane shown in its properties.
area = |½ Σ (xᵢ yᵢ₊₁ − yᵢ xᵢ₊₁)| ÷ cos θ
Figures shown in the residential panels and schedules res-ui.js64-bit- BimCraft
-
Cut list schedule
The lumber schedule's rows: size, stock length, pieces and board feet, with totals.
board feet shown = bf.toFixed(1)
Figures shown in the residential panels and schedules res-ui.js64-bit- BimCraft
-
Board feet of a framing in Properties
Shows the piece count and board feet of one framing.
shown = Math.round(BoardFeet)
Figures shown in the residential panels and schedules res-ui.js64-bit- BimCraft
-
Cut and fill in Properties
Shows the terrain's cut and fill volumes.
shown = V.toFixed(1) m³
Figures shown in the residential panels and schedules res-ui.js64-bit- BimCraft
-
Direction and height of a new stair
The direction a new stair runs, from its start point to the pointer, and the height it climbs.
angle = atan2(Δy, Δx) × 180 ÷ π; height = elevation above − elevation here
Figures shown in the residential panels and schedules res-ui.js64-bit- BimCraft
-
Building width on an elevation (fallback)
The overall width of the building across a view direction, used for the width note on an elevation when the wall-based width is not available.
x = q · r ± t ÷ 2 over every wall end; width from min to max
Figures shown in the residential panels and schedules res-ui.js64-bit- BimCraft
-
Inverse of a level's placement
Inverts a level's 4×4 world matrix to bring site coordinates back into the level's plan.
R⁻¹ = Rᵀ; t⁻¹ = −Rᵀ t
Figures shown in the residential panels and schedules res-ui.js64-bit- BimCraft
-
Local origin and merging of points
Moves every point to a local origin and makes points that fall on the same spot one vertex.
origin = ⌊min x⌋, ⌊min y⌋; key = round(x ÷ 1e-4), round(y ÷ 1e-4)
Ground surface triangulation and contours tin.js64-bit- BimCraft
- CivilCraft
-
Coordinates handed to the triangulator
Packs the local coordinates for Delaunator and runs the Delaunay triangulation.
coords = (x, −y) per vertex
Ground surface triangulation and contours tin.js64-bit- BimCraft
- CivilCraft
-
Boundary clipped to the data and given elevations
Clips the outer boundary to the convex hull of the data and takes each corner's elevation from a first surface built without it.
z_corner = elevationAt(x, y) with a 1e-6 edge tolerance
Ground surface triangulation and contours tin.js64-bit- BimCraft
- CivilCraft
-
Triangles kept inside the boundary
Drops the triangles whose center lies outside the boundary.
keep when the centroid (Σx ÷ 3, Σy ÷ 3) is inside the boundary polygon
Ground surface triangulation and contours tin.js64-bit- BimCraft
- CivilCraft
-
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.js64-bit- BimCraft
- CivilCraft
-
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.js64-bit- BimCraft
- CivilCraft
-
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.js64-bit- BimCraft
- CivilCraft
-
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.js64-bit- BimCraft
- CivilCraft
-
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.jsExact- BimCraft
- CivilCraft
-
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.jsExact- BimCraft
- CivilCraft
-
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.js64-bit- BimCraft
- CivilCraft
-
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.js64-bit- BimCraft
- CivilCraft
-
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.js64-bit- BimCraft
- CivilCraft
-
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.js64-bit- BimCraft
- CivilCraft
-
Polygon area
The signed area of a polygon.
A = ½ Σ (xᵢ yᵢ₊₁ − xᵢ₊₁ yᵢ)
Ground surface triangulation and contours tin.js64-bit- BimCraft
- CivilCraft
-
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.js64-bit- BimCraft
- CivilCraft
-
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.js64-bit- BimCraft
- CivilCraft
-
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.js64-bit- BimCraft
-
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.js64-bit- BimCraft
-
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.js64-bit- BimCraft
-
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.js64-bit- BimCraft
-
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.js64-bit- BimCraft
-
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.js64-bit- BimCraft
-
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.js64-bit- BimCraft
-
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.js64-bit- BimCraft
-
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.js64-bit- BimCraft
-
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.js64-bit- BimCraft
-
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.js64-bit- BimCraft
-
Corners of an item
The four corners in plan of an item of given width, depth, position and turn.
corner = (x₀ + x cos a − y sin a, y₀ + x sin a + y cos a), a = rot × π ÷ 180
Factory layout checks addons/plant/lib/layout.js64-bit- BimCraft
-
Access strips
The strips beside each side of an item that must stay free, as turned rectangles.
Factory layout checks addons/plant/lib/layout.js64-bit- BimCraft
-
Overlap of two convex polygons
Whether two items, or an item and an access strip or obstacle, overlap by more than a sliver.
separated if maxA ≤ minB + tol or maxB ≤ minA + tol on any edge normal; tol = 1
Factory layout checks addons/plant/lib/layout.js64-bit- BimCraft
-
Distance from a point to a segment
The shortest distance from a corner of one item to an edge of another.
t = clamp(((p − a) · (b − a)) ÷ |b − a|², 0, 1); d = |p − (a + t (b − a))|
Factory layout checks addons/plant/lib/layout.js64-bit- BimCraft
-
Gap between two items
The least distance between two items that do not overlap, compared with the minimum aisle width.
gap = min over corners and edges of the point-to-segment distance
Factory layout checks addons/plant/lib/layout.js64-bit- BimCraft
-
Floor load of an item
The weight of an item divided by its footprint area, compared with the floor load limit.
load = weight ÷ (area ÷ 10⁶) in kg per m²; area = |Σ (xᵢ yᵢ₊₁ − xᵢ₊₁ yᵢ)| ÷ 2
Factory layout checks addons/plant/lib/layout.js64-bit- BimCraft
-
Footprint of Plant equipment
The width, depth, height and center of a piece of Plant equipment for the layout, from its bounding box.
Factory layout checks addons/plant/lib/layout.js64-bit- BimCraft
-
Flow path length
The length of the path through a sequence of items, measured center to center along X then Y.
L = Σ (|Δx| + |Δy|)
Factory layout checks addons/plant/lib/layout.js64-bit- BimCraft
-
Openings and walls on a room's edge
Finds the doors, windows and walls that lie on the outline of a room.
t = clamp(((p − a) · (b − a)) ÷ |b − a|², 0, 1); d = |p − a − t (b − a)|; on the edge if d ≤ tolerance
Rooms handed to add-ons with their doors, windows and walls addons/bimcraft-api.js64-bit- BimCraft
-
SI value of a file unit
Meters per file length unit and radians per file angle unit.
SI unit: 10^prefix; conversion-based unit: factor × factor of its base unit; by name: degree π ÷ 180, inch 0.0254, foot 0.3048
IFC units and placements ifc/geo-ctx.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Axis placement as a matrix
The matrix of an IfcAxis2Placement3D, 2D or IfcAxis1Placement.
columns = (x, z × x, z, origin), x = reference direction projected square to z
IFC units and placements ifc/geo-ctx.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
First projection axis
The X axis of a placement: the reference direction projected into the plane normal to Z.
x = normalize(v − z (v · z))
IFC units and placements ifc/geo-ctx.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Cartesian transformation operator
The matrix of an IfcCartesianTransformationOperator, uniform or not, in 2D or 3D.
columns = (x s₁, y s₂, z s₃, origin)
IFC units and placements ifc/geo-ctx.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
World matrix of a placement
The position of an element in the model from its chain of relative placements.
world = parent world × local
IFC units and placements ifc/geo-ctx.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
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.