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
-
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
-
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
-
Grid placement
The point where two grid axes meet, with their offsets, as a placement.
t = ((pB − pA) × dB) ÷ (dA × dB); point = pA + dA t
IFC units and placements ifc/geo-ctx.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Map conversion
The matrix that takes model coordinates to map coordinates, with its rotation and scale.
map = (E, N, H) + R(θ) · S · model; θ = atan2(ordinate, abscissa)
IFC units and placements ifc/geo-ctx.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Matrix product
The product of two 4 × 4 matrices.
IFC units and placements ifc/geo-math.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Point through a matrix
Transforms a point by a matrix.
p' = M · (x, y, z, 1)
IFC units and placements ifc/geo-math.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Matrix inverse
The inverse of a 4 × 4 matrix, or null when it has none.
M⁻¹ = adjugate ÷ determinant
IFC units and placements ifc/geo-math.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Rotation about an axis
The matrix that turns by an angle about an axis through the origin.
R = c I + s [a]× + (1 − c) a aᵀ
IFC units and placements ifc/geo-math.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Polygon normal
The normal of a 3D polygon, with a length of twice its area.
n = Σ ((yₐ − y_b)(zₐ + z_b), (zₐ − z_b)(xₐ + x_b), (xₐ − x_b)(yₐ + y_b))
IFC units and placements ifc/geo-math.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Signed area of a 2D polygon
The area of a profile outline, positive when counter-clockwise; used to orient outlines and holes.
A = Σ (xₐ y_b − x_b yₐ) ÷ 2
IFC units and placements ifc/geo-math.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Positions and normals handed to the app
Packs the mesh into the vertex and index arrays the apps read.
vertices = Float32Array of (x, y, z, nx, ny, nz) per vertex
Triangle mesh built from IFC geometry ifc/geo-mesh.js32-bit in part- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Planar face
Adds one planar face with holes as triangles, all with the face's normal.
Triangle mesh built from IFC geometry ifc/geo-mesh.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Mesh moved by a matrix
Adds another mesh, transformed, with its normals turned to match.
p' = M p; n' = normalize((M⁻¹)ᵀ n); a mirror swaps the winding
Triangle mesh built from IFC geometry ifc/geo-mesh.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Signed volume
The volume enclosed by the mesh, positive when the triangles face outward.
V = Σ a · (b × c) ÷ 6
Triangle mesh built from IFC geometry ifc/geo-mesh.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Shared vertices
Merges vertices that fall in the same grid cell, for boolean operations.
key = (round(x ÷ eps), round(y ÷ eps), round(z ÷ eps))
Triangle mesh built from IFC geometry ifc/geo-mesh.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Segments of an arc
How many chords replace an arc of a given sweep.
n = max(2, ceil(|sweep| ÷ 2π × 36))
IFC curves and profiles as point lists ifc/geo-curve.jsExact- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Arc through three points
The circular arc of an indexed poly-curve from its start, middle and end points.
center = a + ((|ab|² (ac × n)) + (|ac|² (n × ab))) ÷ (2 |n|²), n = ab × ac
IFC curves and profiles as point lists ifc/geo-curve.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Circle and ellipse points
Points on a circle or ellipse between two parameters.
p = M · (r₁ cos θ, r₂ sin θ, 0), θ = a₀ + sweep × i ÷ n
IFC curves and profiles as point lists ifc/geo-curve.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Trimmed curve
The part of a line, circle, ellipse or other curve between two trims given as parameters or points.
conic: angle = parameter × angle unit, or atan2 of the trim point in the conic's frame
IFC curves and profiles as point lists ifc/geo-curve.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
B-spline curve points
Points on a B-spline curve, rational or not, at 12 evenly spaced parameters per knot span.
de Boor: d_j = (1 − a) d_{j−1} + a d_j, a = (u − k_i) ÷ (k_{i+p+1−r} − k_i); point = (x, y, z) ÷ w
IFC curves and profiles as point lists ifc/geo-curve.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Offset of a polyline
A 2D polyline moved to its left by a distance, with mitered corners.
p' = p + n × d ÷ max(0.2, n · n₁), n = normalized sum of the two edge normals
IFC curves and profiles as point lists ifc/geo-curve.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Circle and ellipse profiles
The outline of a circular, hollow circular or elliptical profile.
(r₁ cos a, r₂ sin a), a = 2π i ÷ 36
IFC curves and profiles as point lists ifc/geo-profile.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Fillets and edge radii
Replaces corners of a profile outline with arcs of given radii tangent to both edges.
d = r ÷ tan(half); center = corner + bisector × r ÷ sin(half), half = half the corner angle
IFC curves and profiles as point lists ifc/geo-profile.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
I-shape outline
The outline of a symmetric or asymmetric I-section with flange slopes, fillets and edge radii.
inner flange face = thickness + tan(slope) × distance from the quarter point of the outstand
IFC curves and profiles as point lists ifc/geo-profile.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Closing an outline
Drops repeated points of a profile curve and its closing point.
IFC curves and profiles as point lists ifc/geo-profile.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Straight extrusion
The solid of a profile swept along a direction by a depth, with end caps and sides.
top = bottom + direction × depth
IFC swept solids, primitives and faceted shapes ifc/geo-solid.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Side face of a sweep
Adds a four-sided face as one flat face or as two triangles.
IFC swept solids, primitives and faceted shapes ifc/geo-solid.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Revolved solid
The solid of a profile turned about an axis by an angle.
p_k = o + R(axis, angle × k ÷ steps) · (p − o), steps = 36 per full turn
IFC swept solids, primitives and faceted shapes ifc/geo-solid.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Frames along a path
The tangent, normal and binormal at each point of a 3D polyline, and the miter stretch at each bend.
tangent = normalize(t_in + t_out); miter = 1 ÷ max(0.25, t_in · tangent)
IFC swept solids, primitives and faceted shapes ifc/geo-solid.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Normal carried round a bend
Turns the section's normal by the rotation that takes the previous tangent to the next.
angle = atan2(|a × b|, a · b); v' = R(a × b, angle) v, made square to b
IFC swept solids, primitives and faceted shapes ifc/geo-solid.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Swept disk
A round bar or tube along a path, such as rebar, with an optional inner radius and bend radius.
section = 36-sided polygon of the radius; swept on the path's frames
IFC swept solids, primitives and faceted shapes ifc/geo-solid.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Bends of a swept path
Rounds the corners of a 3D polyline with arcs of a given radius.
d = min(r ÷ tan(half), 0.999 × each leg); center = corner + bisector × r' ÷ sin(half)
IFC swept solids, primitives and faceted shapes ifc/geo-solid.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Sphere
The mesh of an IfcSphere.
(r sin θ cos φ, r sin θ sin φ, r cos θ), θ = π i ÷ 12, φ = 2π j ÷ 24
IFC swept solids, primitives and faceted shapes ifc/geo-solid.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Outer bound of a face
Picks the largest loop of a face as its outer bound when the file marks none.
size = |Σ ((yₐ − y_b)(zₐ + z_b), (zₐ − z_b)(xₐ + x_b), (xₐ − x_b)(yₐ + y_b))| (twice the area)
IFC swept solids, primitives and faceted shapes ifc/geo-brep.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Repeated points of a loop
Drops consecutive points of a face loop that coincide, and a closing point equal to the first.
IFC swept solids, primitives and faceted shapes ifc/geo-brep.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Point on a clothoid
The point at a length along a clothoid from its origin.
x = ∫₀ˢ cos(k u²) du, y = ∫₀ˢ sin(k u²) du, k = sign(A) ÷ (2A²); Simpson's rule
IFC alignment curves and stations ifc/geo-align.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.