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

  • Points of a curve segment

    Samples one alignment segment from its parent curve and places it at the segment's start.

    n = max(2, min(400, ceil(|length| ÷ 2))); p_i = T · f(start + length × i ÷ n)

    IFC alignment curves and stations ifc/geo-align.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Distance along the alignment

    The horizontal distance of each sampled point from the start.

    d_i = d_{i−1} + √(Δx² + Δy²)

    IFC alignment curves and stations ifc/geo-align.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Height from the vertical profile

    The height of each horizontal point from the alignment's vertical profile.

    z = z_lo + (z_hi − z_lo) × (d − d_lo) ÷ (d_hi − d_lo)

    IFC alignment curves and stations ifc/geo-align.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Point at a station

    The position and direction on a curve at a distance along it.

    p = p_{i−1} + (p_i − p_{i−1}) × (d − d_{i−1}) ÷ (d_i − d_{i−1})

    IFC alignment curves and stations ifc/geo-align.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Placement along an alignment

    The matrix of an element placed at a station with lateral, vertical and longitudinal offsets.

    origin = p + left × lateral + (0, 0, vertical) + heading × longitudinal

    IFC alignment curves and stations ifc/geo-align.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Solid between cross sections

    The solid of an IfcSectionedSolidHorizontal: cross sections placed across the alignment at their stations and joined.

    ring point = o + x × ((1 − f) a_x + f b_x) + y × ((1 − f) a_y + f b_y), f = (d − d₀) ÷ (d₁ − d₀)

    IFC alignment curves and stations ifc/geo-align.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • 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.js
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Rounding to three decimals

    The rounding applied to every stored length, spacing and symbol coordinate.

    r3(v) = round(v × 1000) ÷ 1000

    Plant sizes, spacing and symbols plants/plants.js
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • Reading a length

    A height, spread, spacing, volume or girth read from a file, a CSV cell or the editor.

    Plant sizes, spacing and symbols plants/plants.js
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • Sizes, hardiness zone and spacing of one species

    The mature size, planting size, zone range and spacing kept for a species row.

    Plant sizes, spacing and symbols plants/plants.js
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • Default planting size and spacing

    The planting size, container and spacing filled in when a species row leaves them empty.

    spacing = max(q, round(k × spread ÷ q) × q), by plant type

    Plant sizes, spacing and symbols plants/plants.js
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • Spacing from planting density

    The center-to-center spacing that gives a stated number of plants per square meter.

    square: s = 1 ÷ √d; triangular: s = √(2 ÷ (√3 × d))

    Plant sizes, spacing and symbols plants/plants.js
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • Spacing used for a species

    The spacing a bed or hedge is planted at: the species' own, else from its density, else the default.

    Plant sizes, spacing and symbols plants/plants.js
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • Supplied sizes written to CSV

    Container volume, height, spread, girth and clear stem of each supplied size as one CSV cell.

    Plant sizes, spacing and symbols plants/plants.js
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • Supplied sizes read from CSV

    The same cell read back into numbers.

    Plant sizes, spacing and symbols plants/plants.js
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • 2D planting symbol

    The circles, lines, arcs and outlines of a plant's plan symbol, sized to its spread.

    R = spread ÷ 2 × scale; point = (r cos a, r sin a)

    Plant sizes, spacing and symbols plants/plants.js
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • Library item size

    The width, depth and height of the library item placed for a plant.

    mm = round(m × 1000)

    Plant sizes, spacing and symbols plants/plants.js
    • BimCraft
    • ModelCraft
    • CivilCraft
    64-bit
  • Longitude and latitude to web Mercator

    The web Mercator x and y in meters for a longitude and latitude in degrees.

    x = R·λ·π ÷ 180; y = R·ln(tan(π ÷ 4 + φ·π ÷ 360)), R = 6378137

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Web Mercator to longitude and latitude

    The longitude and latitude in degrees for a web Mercator x and y in meters.

    λ = x ÷ R × 180 ÷ π; φ = (2·atan(e^(y ÷ R)) − π ÷ 2) × 180 ÷ π

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Standard tile grid

    The origin and the resolution of each zoom level of the usual 256-pixel web Mercator tiles.

    origin = (−πR, πR); res(z) = 2πR ÷ 256 ÷ 2^z, z = 0…22

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Tile that holds a place

    The tile column and row at a zoom level for a longitude and latitude.

    col = ⌊(x + πR) ÷ (res × 256)⌋; row = ⌊(πR − y) ÷ (res × 256)⌋

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Tiles covering a box

    The tiles of a grid that cover a box, each with its bounds in the grid's units.

    bounds = [ox + c·tw, oy − (r + 1)·th, ox + (c + 1)·tw, oy − r·th], tw = res × tile width

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Meters per unit of a coordinate system

    The length in meters of one degree, foot, US survey foot or meter, for turning a WMTS scale into a resolution.

    degree: 2π × 6378137 ÷ 360; foot: 0.3048; US survey foot: 1200 ÷ 3937; otherwise 1

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Tile grid of a WMTS tile matrix set

    The resolution and top-left corner of each level of a WMTS tile matrix set.

    res = scale denominator × 0.00028 ÷ meters per unit

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • World file to a pixel-corner transform

    The transform from pixel corners to coordinates for a picture, from the six numbers of its world file.

    x₀ = C − A ÷ 2 − B ÷ 2; y₀ = F − D ÷ 2 − E ÷ 2

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Pixel to coordinates

    The coordinates of a pixel position in a picture's own system.

    x = g₀ + u·g₁ + v·g₂; y = g₃ + u·g₄ + v·g₅

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Numbers in a map request

    How the corners of the requested box are written into a WMS or map-server export address.

    |v| ≥ 10,000: v.toFixed(3); otherwise v.toPrecision(12)

    Map layers: web Mercator, tile grids and world files basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    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.