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
-
Cylinder and cone
A point on a cylindrical or conical surface from (u, v), and (u, v) from a point.
p = o + (r + v tan α)(x cos u + y sin u) + z v; u = atan2(d · y, d · x), v = d · z
IFC faces on curved surfaces ifc/geo-nurbs.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Swept curve by length
The generating curve of an extruded or revolved surface as a polyline with a length parameter.
s_i = s_{i−1} + |p_i − p_{i−1}|; point at s by linear interpolation
IFC faces on curved surfaces ifc/geo-nurbs.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
B-spline basis functions
The non-zero basis functions of a B-spline at a parameter.
Cox-de Boor: N_r = saved + right × N_r ÷ (right + left)
IFC faces on curved surfaces ifc/geo-nurbs.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Point on a B-spline surface
The point of a B-spline surface, rational or not, at (u, v).
p = Σ N_i(u) N_j(v) (w P)_ij ÷ Σ N_i(u) N_j(v) w_ij
IFC faces on curved surfaces ifc/geo-nurbs.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Parameters of a point on a B-spline surface
Finds (u, v) of a 3D point on a B-spline surface.
start at the nearest of 25 × 25 samples; Newton: solve (Sᵤ·Sᵤ, Sᵤ·Sᵥ; Sᵤ·Sᵥ, Sᵥ·Sᵥ) Δ = (r·Sᵤ, r·Sᵥ)
IFC faces on curved surfaces ifc/geo-nurbs.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Boundary points put back on the surface
Moves a boundary point onto the surface when the file's edge curve leaves it.
tolerance = max(10⁻⁹, 0.001 × diagonal of the loops' box)
IFC faces on curved surfaces ifc/geo-nurbs.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Spacing of interior points
The spacing of the points added inside a face, from how fast the surface normal turns.
h = clamp(0.2 ÷ turn, extent ÷ 96, extent ÷ 4), turn = largest change of the normal per unit over a 9 × 9 grid
IFC faces on curved surfaces ifc/geo-nurbs.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Scale of the parameter plane
Scale factors that make distances in (u, v) roughly equal to distances on the surface.
s_u = mean |S(u + e, v) − S(u, v)| ÷ e, e = 10⁻⁴ (1 + |u|)
IFC faces on curved surfaces ifc/geo-nurbs.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Circumcircle of a triangle
The center and squared radius of a triangle's circumcircle, for the Delaunay test.
D = 2 (a_x (b_y − c_y) + b_x (c_y − a_y) + c_x (a_y − b_y)); center = Σ |p|² × (difference) ÷ D
IFC faces on curved surfaces ifc/geo-nurbs.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Delaunay triangulation
Triangulates the face's points in the scaled parameter plane.
a point is inside a circumcircle when (x − c_x)² + (y − c_y)² < r² (1 + 10⁻¹²)
IFC faces on curved surfaces ifc/geo-nurbs.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Orientation and crossing tests
Whether three points turn left or right, and whether two segments cross, for recovering the boundary edges.
orient = (b_x − a_x)(c_y − a_y) − (b_y − a_y)(c_x − a_x)
IFC faces on curved surfaces ifc/geo-nurbs.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
SI value of the file's units
The factor that turns the file's length, area, volume and mass values into meters, square meters, cubic meters and kilograms.
SI unit: factor = prefix; conversion-based unit: the file's factor; gram: × 0.001
IFC 4.3 infrastructure quantities and files ifc/ifc43.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Quantities of an element
The lengths, areas, volumes and weights an element states in its quantity sets, in SI units.
SI value = stated value × unit factor
IFC 4.3 infrastructure quantities and files ifc/ifc43.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Length of an alignment
The length of an alignment curve from the lengths of its segments.
L = Σ |SegmentLength|
IFC 4.3 infrastructure quantities and files ifc/ifc43.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Rounding of totals
Rounds a total length, area or volume before it is listed or written to a quantities file.
ROUND(v) = v to 12 significant digits
IFC 4.3 infrastructure quantities and files ifc/ifc43.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Totals per class
The count and the total length, area and volume of each class and predefined type.
total = Σ of the first stated quantity of that kind per element
IFC 4.3 infrastructure quantities and files ifc/ifc43.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Numbers in a written file
Formats a coordinate, length or quantity for a new IFC 4.3 file.
R(v, d) = v with d decimals, trailing zeros removed; d = 9, or 12 for directions
IFC 4.3 infrastructure quantities and files ifc/ifc43.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Alignment segments written
The straight segments of a written alignment: each one's start, direction and length.
length = √(Δx² + Δy²); direction = (Δx, Δy) ÷ length
IFC 4.3 infrastructure quantities and files ifc/ifc43.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Area of a written profile
The cross-section area of an element in a written file, from its rectangle, circle or polygon.
circle: π r²; polygon: |Σ (xₐ y_b − x_b yₐ)| ÷ 2; rectangle: w × d
IFC 4.3 infrastructure quantities and files ifc/ifc43.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Quantities written for an element
The length, width, height, footprint area and volume written to an element's quantity set.
Length = longer side; Width = shorter side; GrossVolume = area × height
IFC 4.3 infrastructure quantities and files ifc/ifc43.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Position and direction of a port
Where a port is, in millimeters, and the way it faces.
p = M · (0, 0, 0) × mm; z = normalize(M · (0, 0, 1) direction)
Piping in an IFC file as PCF components ifc/pipes.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Ends and bore from the extruded body
The two ends of a pipe segment and its bore from its extruded solid.
a = T · 0; b = T · (direction × depth); bore = 2 × radius × mm
Piping in an IFC file as PCF components ifc/pipes.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Turn angle of a fitting
The angle a two-port fitting turns the pipe through.
turn = 180 − acos(p · q) × 180 ÷ π, rounded to 2 decimals
Piping in an IFC file as PCF components ifc/pipes.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Center point of a bend
The corner where the axes of a bend's two ports meet.
s = (b e − c d) ÷ (a c − b²), t = (a e − b d) ÷ (a c − b²); center = midpoint of the two closest points
Piping in an IFC file as PCF components ifc/pipes.js64-bit- BimCraft
- TakeoffCraft
- CivilCraft
- DetailCraft
-
Fixture units a size carries
The fixture units a drain of a nominal size carries at a slope, as a branch or as a building drain.
column = last listed slope ≤ slope + 10⁻⁹; capacity = table[size][column]
Sanitary drain sizing by fixture units mep/drainage.jsExact- BimCraft
-
Smallest size that carries the load
The first size, smallest first, that carries the fixture units and is not below the least size allowed.
Sanitary drain sizing by fixture units mep/drainage.jsExact- BimCraft
-
Distance from a point to a run
The shortest distance from a run's end or a fixture's connector to another run's center line.
t = clamp(((p − a) · d) ÷ |d|², 0, 1); distance = |p − a − d t|
Sanitary drain sizing by fixture units mep/drainage.js64-bit- BimCraft
-
Fixture units carried by each run
Which run each run and fixture drains into, and the total fixture units and least size of every run.
total = own fixtures + Σ totals of the runs flowing in
Sanitary drain sizing by fixture units mep/drainage.jsExact- BimCraft
-
Typed sizes of a piece of equipment
Checks the values a person typed and gives the sizes the equipment is built from.
length = round(v, 3), 10 ≤ v ≤ 20000
MEP equipment, ports and refrigerant line sets mep/equipment.js64-bit- BimCraft
-
Equipment solids as a mesh
Turns the boxes and cylinders of a piece of equipment into one triangle mesh.
cylinder ring = o + u r cos a + w r sin a, a = 2π i ÷ 16; each coordinate rounded to 3 decimals
MEP equipment, ports and refrigerant line sets mep/equipment.js64-bit- BimCraft
-
Port positions of placed equipment
Where each port of a placed piece sits on its level and the way it faces.
at = (x, y, z) + R(rot) · local; R turns about Z by rot × π ÷ 180
MEP equipment, ports and refrigerant line sets mep/equipment.js64-bit- BimCraft
-
Port sizes written to the model
The width and height stored on each port.
stored = round(size in the file's unit)
MEP equipment, ports and refrigerant line sets mep/equipment.js64-bit- BimCraft
-
Placement stored with the equipment
The position and turn kept in the equipment's property set, from which it is read back and rebuilt.
X, Y, Z = round(value, 3); Rotation = round(degrees, 6)
MEP equipment, ports and refrigerant line sets mep/equipment.js64-bit- BimCraft
-
Line set sizes for a capacity
The liquid and gas tube sizes for the cooling capacity a refrigerant line carries.
row = first with capacity ≤ upTo + 10⁻⁹; beyond the table: the last row
MEP equipment, ports and refrigerant line sets mep/hvac.jsExact- BimCraft
-
A line set table someone typed
Checks a custom table of capacities and tube sizes before it is used and saved.
upTo = round(upTo × 100) ÷ 100, 0 < upTo ≤ 2000, rising
MEP equipment, ports and refrigerant line sets mep/hvac.js64-bit- BimCraft
-
Refrigerant tube diameter
The outside diameter in millimeters of a refrigerant tube from its inch size.
od = table inches × 25.4
MEP equipment, ports and refrigerant line sets mep/hvac.js64-bit- BimCraft
-
Route of a line between two ports
An orthogonal path from one port to another: straight out of each, up to a common height, then across.
points rounded to 3 decimals; common height = max of the two leads + lift + 0, 300 or 600
MEP equipment, ports and refrigerant line sets mep/hvac.js64-bit- BimCraft
-
Cleaning a route
Drops repeated points and corners that go straight through.
merge if |p − q| ≤ 0.5; straight if |d₁ · d₂ − |d₁||d₂|| < 10⁻⁶ |d₁||d₂|
MEP equipment, ports and refrigerant line sets mep/hvac.js64-bit- BimCraft
-
Soundness of a route
Rejects a route that doubles back, has an inner leg shorter than 100 mm, or has a leg that is not along one axis.
MEP equipment, ports and refrigerant line sets mep/hvac.js64-bit- BimCraft
-
Position and direction of a port read from the model
A port's origin and the way it faces, in its level's axes in millimeters.
at = round(M₁₂…₁₄ × 1000) ÷ 1000; out = round(z ÷ |z| × 10⁹) ÷ 10⁹
MEP equipment, ports and refrigerant line sets mep/ports.js64-bit- BimCraft
-
Bore of a component
The bore written for a pipe section.
bore = nominal diameter for the pipe size, else outside diameter to 1 decimal
PCF piping files from and to pipe runs mep/pcf-bim.js64-bit- BimCraft
-
Corner and angle of a bend
The corner point and turn angle written for an elbow or bend.
corner = p₀ + d₁ × R tan(θ ÷ 2); angle = θ × 180 ÷ π to 2 decimals
PCF piping files from and to pipe runs mep/pcf-bim.js64-bit- BimCraft
-
Where two legs meet
The corner of an imported elbow from the legs before and after it.
s = (b e − c d) ÷ (a c − b²), t = (a e − b d) ÷ (a c − b²); corner = midpoint of the two closest points
PCF piping files from and to pipe runs mep/pcf-bim.js64-bit- BimCraft
-
Position of a valve along a run
The distance along an imported run to the point nearest a valve.
s = Σ earlier leg lengths + clamp((p − a) · d, 0, L), rounded to 1 decimal
PCF piping files from and to pipe runs mep/pcf-bim.js64-bit- BimCraft
-
Pipe size for an imported bore
The standard nominal diameter nearest to a bore that is not a standard size.
nearest = table value with the least |value − bore|
PCF piping files from and to pipe runs mep/pcf-bim.jsExact- BimCraft
-
Child boxes of a node
Stores the boxes of a node's four children as 8-bit offsets from the node's corner.
scale = 2^e, the smallest with 255 × 2^e ≥ extent; lo = floor((box − origin) ÷ scale), hi = ceil(…)
Ray casting for rendering and the render bench compute/bvh-wide.js32-bit, display only- BimCraft
- ModelCraft
-
Ray through the hierarchy
Walks the hierarchy along a ray and returns the nearest hit distance.
per axis: t = (box − origin) × (1 ÷ direction); hit if max of the near values ≤ min of the far values × (1 + 4×10⁻⁷)
Ray casting for rendering and the render bench compute/bvh-wide.js32-bit, display only- BimCraft
- ModelCraft
-
Preview shading of a tile
Shades each pixel of a tile from the surface it sees, lit from the eye.
value = 0.08 + 0.72 × |n · d| ÷ |n|
Ray casting for rendering and the render bench compute/preview-kernel.js32-bit, display only- BimCraft
- ModelCraft
-
Camera rays for one tile
Casts the camera rays of a tile and counts the rays, the hits and the sum of the hit distances, for timing.
direction = normalize(camera matrix · ((2 (x + jitter) ÷ W − 1) ÷ f_x, (1 − 2 (y + jitter) ÷ H) ÷ f_y, −1))
Ray casting for rendering and the render bench compute/raycast-job.js32-bit, display only- BimCraft
- ModelCraft
-
Mean and variance from batches
The mean picture and the variance of that mean from two or more independent batch pictures.
mean = Σ b ÷ k; var(mean) = Σ (b − mean)² ÷ (k − 1) ÷ k
Statistical comparison of rendered pictures compute/parity.js64-bit- BimCraft
- ModelCraft
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.