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

  • Clip polygon in drawing coordinates

    The clip polygon of a reference moved from the block's coordinates into the drawing.

    M = m · insert matrix; point = M · p

    Clipping block references to a boundary xclip.js
    • CadCraft
    64-bit
  • Clip read from a file

    Turns the clip boundary stored in a DWG or DXF file into the polygon kept on the reference.

    point = I · (T · p), with T the clip transform and I the inverse block transform (3 × 4 each)

    Clipping block references to a boundary xclip.js
    • CadCraft
    64-bit
  • Objects cut to the clip when binding

    The objects of a block cut to the clip polygon: whole when inside, as line and arc pieces when crossing.

    Clipping block references to a boundary xclip.js
    • CadCraft
    64-bit
  • New clip boundary into block coordinates

    Stores a boundary picked in the drawing as a polygon in the block's own coordinates.

    d = m₀·m₃ − m₁·m₂; inv = adjugate ÷ d; stored point = inv · picked point

    Clipping block references to a boundary xclip.js
    • CadCraft
    64-bit
  • Paper sizes

    The two home-printer papers, in millimeters.

    A4 = 210 × 297; Letter = 215.9 × 279.4 (8.5 × 11 in × 25.4)

    Printing patterns at full size addons/apparel/lib/print.js
    • CadCraft
    Exact
  • Test square

    The side of the square printed on the cover page to check the scale.

    10 cm = 100 mm; 4 in = 101.6 mm

    Printing patterns at full size addons/apparel/lib/print.js
    • CadCraft
    Exact
  • Full-size page

    The page size and the placement of the pieces on a single full-size page.

    w = (maxX − minX)·k + 2·margin; h = (maxY − minY)·k + 2·margin + 8; matrix = [k, 0, 0, k, margin − minX·k, margin − minY·k]

    Printing patterns at full size addons/apparel/lib/print.js
    • CadCraft
    64-bit
  • Tile grid

    How many tiles across and down the pieces need.

    pw = paper w − 2·margin; ph = paper h − 2·margin − 8; step = pw − overlap, ph − overlap; cols = max(1, ⌈(W − overlap) ÷ step − 1e-9⌉)

    Printing patterns at full size addons/apparel/lib/print.js
    • CadCraft
    64-bit
  • Which tiles have something on them

    Marks the tiles a point of the drawing falls on, so empty tiles are not printed.

    c from ⌈(x − pw) ÷ sx⌉ to ⌊x ÷ sx⌋; r from ⌈(−y − ph) ÷ sy⌉ to ⌊−y ÷ sy⌋

    Printing patterns at full size addons/apparel/lib/print.js
    • CadCraft
    64-bit
  • Placement on one tile

    Where the pieces land on the page of one tile.

    tx = c·sx; ty = −r·sy; matrix = [k, 0, 0, k, margin − tx − minX·k, (paper h − margin − 8) − ty − maxY·k]

    Printing patterns at full size addons/apparel/lib/print.js
    • CadCraft
    64-bit
  • Rule units per drawing unit

    The factor between the drawing's unit and the cabinet rules' unit, and its reciprocal.

    per = meters per drawing unit ÷ (0.0254 or 0.001); k = 1 ÷ per

    Cabinets along a wall line addons/cabinet/main.js
    • CadCraft
    64-bit
  • Placing a cabinet on the run

    The insertion point and rotation of a new cabinet, and where the next one starts.

    w = typed × per; x = runₓ + cos(ang)·pos·k; y = runᵧ + sin(ang)·pos·k; next pos = pos + w

    Cabinets along a wall line addons/cabinet/main.js
    • CadCraft
    64-bit
  • Cabinets of a front view

    Which cabinets stand on a wall line and how far along it, for the front view.

    on the run when |sin(rot − ang)| ≤ 1e-6, cos(rot − ang) ≥ 0 and |offset| ≤ 0.5 × depth × k; x = s ÷ k − smallest x, rounded to 6 decimals

    Cabinets along a wall line addons/cabinet/main.js
    • CadCraft
    64-bit
  • Area as text

    The area of a material group on the command line.

    in² ÷ 144 = ft²; mm² ÷ 1e6 = m²; 3 decimals

    Cabinets along a wall line addons/cabinet/main.js
    • CadCraft
    64-bit
  • Edge banding length as text

    The length of edge banding on the command line.

    in ÷ 12 = ft; mm ÷ 1000 = m; 3 decimals

    Cabinets along a wall line addons/cabinet/main.js
    • CadCraft
    64-bit
  • Sheet use in percent

    The share of each material's sheets covered by parts, as printed after nesting.

    percent = round(efficiency × 100)

    Cabinets along a wall line addons/cabinet/main.js
    • CadCraft
    64-bit
  • One cabinet in plan

    The cabinet seen from above in its own frame, with its fronts, number and width label.

    W = w × k; D = d × k; label = round(w × 100) ÷ 100

    Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/draw.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Front view of a run

    Each cabinet's box, plinth and fronts along the run, x along the wall and y up from the floor.

    X = x × k; front at (X + f.x × k, base + f.y × k)

    Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/draw.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Frame of a run from two wall points

    The origin, angle and length of a run picked by two points on a wall and a point in the room.

    len = √(Δx² + Δy²); left = (room − a) × u; ang = atan2(u_y, uₓ)

    Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/draw.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Point in a run's frame

    The distance along a run and out from the wall of a point.

    s = Δx cos a + Δy sin a; off = −Δx sin a + Δy cos a

    Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/draw.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Cabinet in section

    The side panel, bottom, top or rails, back, shelves, plinth, fronts and drawer boxes of a cabinet cut through its middle.

    shelf i of n: y = bottom + (top − bottom) × (i + 1) ÷ (n + 1) − t ÷ 2

    Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/draw.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Drawing extent and SVG coordinates

    The size of a drawing and the coordinates written into its SVG.

    W = x₁ − x₀; H = y₁ − y₀; each coordinate written as round(v × 1e6) ÷ 1e6

    Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/drawings.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Cabinets placed on the room plan

    The rectangle of each cabinet, filler and end panel in room coordinates.

    corner = toWorld(frame, s + x, o)

    Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/drawings.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Room dimensions on the plan

    The overall width and depth dimensions of the room.

    label = fmtLen(W, unit)

    Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/drawings.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Foreshortened width on a curved wall

    The drawn width of a cabinet that is turned on a curved wall, in the elevation.

    kₓ = max(0.05, (ext₁ − ext₀) ÷ w); drawn width = w × kₓ

    Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/drawings.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Overall run length and height in the elevation

    The total length of a run and the height to the top of its tallest cabinet.

    length = b − a; top = max(elevation + height)

    Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/drawings.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Section of one cabinet with dimensions

    The section view of one cabinet with its face frame, fronts, overall depth and height.

    depth shown = d + frame thickness + front thickness

    Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/drawings.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Cabinet panels as boxes

    The carcass panels, back, shelves, plinth and fronts of a cabinet as boxes in its own frame.

    shelf i of n: z = bottom + (top − bottom) × (i + 1) ÷ (n + 1) − t ÷ 2

    Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/solid.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Boxes placed in the drawing

    The faces of each box in drawing coordinates, for the 3D tab.

    X = x + lx cos r − ly sin r; Y = y + lx sin r + ly cos r; Z = (z + elev) × k

    Cabinet plan, elevation, section and 3D boxes addons/cabinetcraft/lib/solid.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • PartCraft
    64-bit
  • Meters per drawing unit

    The factor that turns a drawing length into meters.

    inch 0.0254; foot 0.3048; yard 0.9144; mm 0.001; cm 0.01; m 1

    Installation loads and cable lengths addons/electrical/lib/install.js
    • CadCraft
    Exact
  • Number read from an attribute

    Turns attribute text such as a load, voltage or breaker rating into a number.

    Installation loads and cable lengths addons/electrical/lib/install.js
    • CadCraft
    64-bit
  • Load of a library item

    The watts of a placed library item from its kW, amps and volts, or horsepower attributes.

    W = kW × 1000; or A × V (× √3 for three phase); or hp × 746

    Installation loads and cable lengths addons/electrical/lib/install.js
    • CadCraft
    64-bit
  • Load per circuit

    The total watts on each circuit and the circuit's current.

    watts = Σ load of the devices on the circuit

    Installation loads and cable lengths addons/electrical/lib/install.js
    • CadCraft
    64-bit
  • Circuit current

    The current a circuit draws.

    I = W ÷ (V × pf); three phase: I = W ÷ (√3 × V × pf)

    Installation loads and cable lengths addons/electrical/lib/install.js
    • CadCraft
    64-bit
  • RCD trip current from text

    Reads the milliamps a circuit's RCD text names.

    Installation loads and cable lengths addons/electrical/lib/install.js
    • CadCraft
    64-bit
  • Route network

    Builds the network of cable routes: nodes, and edges with their lengths, split where one route's end lands on another.

    split point = a + (b − a) × u; edge length = √(Δx² + Δy²)

    Installation loads and cable lengths addons/electrical/lib/install.js
    • CadCraft
    64-bit
  • Device joined to the nearest route

    Connects a board or device to the nearest point of a route within reach, and counts the drop.

    drop = √d²; split lengths = len × u and len × (1 − u)

    Installation loads and cable lengths addons/electrical/lib/install.js
    • CadCraft
    64-bit
  • Shortest routes from the board

    The shortest distance from the board to every node of the route network.

    Dijkstra: dist[v] = min(dist[v], dist[u] + len)

    Installation loads and cable lengths addons/electrical/lib/install.js
    • CadCraft
    64-bit
  • Cable length of a circuit

    The meters of cable a circuit needs.

    meters = Σ used edges × meters per unit + devices reached × 0.5 + 1

    Installation loads and cable lengths addons/electrical/lib/install.js
    • CadCraft
    64-bit
  • Squared distance from a point to a segment

    How far a point is from a wire segment, and where along the segment the nearest point lies.

    u = clamp((p − a)·(b − a) ÷ |b − a|², 0, 1); q = a + u (b − a); d² = |p − q|²

    Schematic wires, pins and connections addons/electrical/lib/wires.js
    • CadCraft
    64-bit
  • Points within a radius

    Finds the stored points within a distance of a point.

    match when (Δx² + Δy²) ≤ r²

    Schematic wires, pins and connections addons/electrical/lib/wires.js
    • CadCraft
    64-bit
  • What a wire end connects to

    Joins a wire end to other wire ends, to pins and to the middle of other wires that it touches.

    connected when distance² ≤ tol², tol = 0.05

    Schematic wires, pins and connections addons/electrical/lib/wires.js
    • CadCraft
    64-bit
  • Where a wire number goes

    The middle and direction of the longest segment of a net, for its wire number.

    x = (aₓ + bₓ) ÷ 2; y = (a_y + b_y) ÷ 2; rot = atan2(Δy, Δx) turned into (−π ÷ 2, π ÷ 2]

    Schematic wires, pins and connections addons/electrical/lib/wires.js
    • CadCraft
    64-bit
  • Which wire a wire number belongs to

    Assigns each wire number to the nearest wire within reach.

    nearest segment with d² ≤ 3²

    Schematic wires, pins and connections addons/electrical/lib/wires.js
    • CadCraft
    64-bit
  • Junction dots

    Places a dot at each junction and removes dots that no longer mark one.

    a dot marks a junction when d² ≤ max(tol, 0.2)²

    Schematic wires, pins and connections addons/electrical/lib/wires.js
    • CadCraft
    64-bit
  • Transform of a placed symbol

    The matrix that takes a symbol's own coordinates to the drawing.

    a = cos r × sx; b = sin r × sx; c = −sin r × sy; d = cos r × sy; e = x − (a bₓ + c b_y); f = y − (b bₓ + d b_y)

    Schematic wires, pins and connections addons/electrical/lib/symbols.js
    • CadCraft
    64-bit
  • A point through the transform

    Applies a symbol's matrix to a point.

    x′ = a x + c y + e; y′ = b x + d y + f

    Schematic wires, pins and connections addons/electrical/lib/symbols.js
    • CadCraft
    64-bit
  • Pin positions of a placed symbol

    The drawing positions of a symbol's connection points.

    Schematic wires, pins and connections addons/electrical/lib/symbols.js
    • CadCraft
    64-bit
  • Pin offsets written to the block

    Formats a pin offset for the block's EL attribute text.

    text = round(n × 1000) ÷ 1000

    Schematic wires, pins and connections addons/electrical/lib/symbols.js
    • CadCraft
    64-bit
  • Attribute text kept upright

    Decides which attribute texts of a rotated symbol would read upside down and turns them half round.

    turn when cos(rot + text rot) ≤ −1e-9

    Schematic wires, pins and connections addons/electrical/lib/symbols.js
    • CadCraft
    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.