Browser-based construction and electrical calculators fail on the jobsite when they stop at naive area / unitSize division. Real field layouts run into truncated-cone geometry, cord-ampacity limits, lumber shrinkage overlaps, and half-block corner alternations.
Below are four self-contained, zero-dependency TypeScript solvers we extracted while building client-side SVG blueprint planners. Every snippet runs in standard ES2022 browsers or Node with zero runtime packages.
1. Cylindrical vs. Flared Bell-Pier Footing Volume (V_frustum)
When a deck post tributary load (Area × (Dead + Live psf)) exceeds the bearing capacity of a straight cardboard concrete tube on 1,500–2,000 psf clay soil, builders attach a flared bell form at the bottom of the shaft below the frost line.
A bell pier is a composite solid: an upper cylinder of radius r and height h_shaft, sitting on a conical frustum of top radius r, base radius R, and bell height h_bell (V_frustum = (π * h_bell / 3) * (R² + R*r + r²)):
export interface PierTakeoff { bearingDiameterIn: number; cubicFeetTotal: number; cubicYardsWithWaste: number; bags80lb: number; // ~0.60 ft³ cured yield per 80-lb premix bag bags60lb: number; // ~0.45 ft³ cured yield per 60-lb premix bag } export function solveBellPierConcrete({ shaftDiameterIn, bellBaseDiameterIn, // Set equal to shaftDiameterIn for straight cylindrical tube totalDepthIn, aboveGradeIn = 6, bellHeightIn = 12, pierCount = 4, wasteFactor = 1.08, }: { shaftDiameterIn: number; bellBaseDiameterIn: number; totalDepthIn: number; aboveGradeIn?: number; bellHeightIn?: number; pierCount?: number; wasteFactor?: number; }): PierTakeoff { const totalHeightIn = totalDepthIn + aboveGradeIn; const r = shaftDiameterIn / 2; const R = Math.max(r, bellBaseDiameterIn / 2); const isFlared = R > r; const hBell = isFlared ? Math.min(bellHeightIn, totalHeightIn) : 0; const hShaft = Math.max(0, totalHeightIn - hBell); const shaftVolIn3 = Math.PI * r * r * hShaft; const frustumVolIn3 = isFlared ? ((Math.PI * hBell) / 3) * (R * R + R * r + r * r) : 0; const singlePierFt3 = (shaftVolIn3 + frustumVolIn3) / 1728; const grossFt3 = singlePierFt3 * pierCount * wasteFactor; return { bearingDiameterIn: R * 2, cubicFeetTotal: Number(grossFt3.toFixed(2)), cubicYardsWithWaste: Number((grossFt3 / 27).toFixed(2)), bags80lb: Math.ceil(grossFt3 / 0.6), bags60lb: Math.ceil(grossFt3 / 0.45), }; } Compared to pouring a full-depth 24" cylinder all the way to grade, flaring a 10" shaft into a 24" bell base cuts concrete bag volume by nearly 55% while preserving the exact same soil bearing footprint under 2024 IRC Table R507.3.1. You can inspect the interactive soil-load lookup and frost-depth cross-section in the live Deck Footing Calculator.
2. Board-on-Board & Spaced Fence Picket 1/16" Spacer Jig Solver
Unlike deck guardrails (which enforce a strict < 4.0" sphere opening), wood fence bays have four distinct geometric modes: even gaps, tight butt-joint privacy, shadowbox alternating rails, and overlapping board-on-board privacy (where front boards leave a gap smaller than the board width and back-layer boards bridge every gap with 1.0"–1.25" overlap per edge so seasonal lumber shrinkage never opens sightlines).
Rounding the solved gap to the nearest 1/16" tells a carpenter the exact scrap-wood spacer block to rip on a table saw—plus the cumulative drift across the bay:
export function solveSpacedFenceBay( clearBayIn: number, picketWidthIn: number, // e.g., 5.5" for nominal 1x6, 3.5" for nominal 1x4 desiredGapIn: number ) { const count = Math.max( 1, Math.round((clearBayIn - desiredGapIn) / (picketWidthIn + desiredGapIn)) ); const gapCount = count + 1; // Equal end-post gaps + interior gaps const exactGapIn = (clearBayIn - count * picketWidthIn) / gapCount; const nearestSixteenthIn = Math.round(exactGapIn * 16) / 16; const cumulativeDriftIn = Number( ((nearestSixteenthIn - exactGapIn) * gapCount).toFixed(3) ); return { picketsPerBay: count, exactGapIn: Number(exactGapIn.toFixed(3)), spacerBlockSixteenthIn: nearestSixteenthIn, cumulativeDriftIn, passesPoolBarrier4InRule: exactGapIn > 0 && exactGapIn < 4.0, }; } We wired all four fence styles—alongside running hook-tape marks and 2×4 stringer rail + ring-shank fastener counts—into our browser-local Picket Spacing Calculator.
3. High-Bay Beam Crossover & Shop-Light Daisy-Chain NEC Limits
Two failure modes show up constantly in workshop and warehouse lighting layouts:
- High-bay floor scalloping: Hanging
60°or90°UFO high bays too far apart relative to net mounting height (H_net = H_ceiling - H_workplane) leaves dark valleys between fixtures because adjacent cones only intersect near the floor. - Overloaded shop-light daisy chains: Standard
4ftlinkable LED shop strips use internal18 AWGpass-through wiring rated for a maximum of 4 to 6 linked fixtures per power drop, well before a15A / 120Vbreaker trips at its NEC 80% continuous limit (1,440W).
export function evaluateShopAndHighBayGrid({ ceilingHeightFt, workplaneFt = 3.0, spacingFt, beamAngleDeg, fixtureCount, wattsPerFixture, maxLinkablePerCord = 6, }: { ceilingHeightFt: number; workplaneFt?: number; spacingFt: number; beamAngleDeg: number; fixtureCount: number; wattsPerFixture: number; maxLinkablePerCord?: number; }) { const netMountFt = Math.max(4, ceilingHeightFt - workplaneFt); const halfBeamRad = ((beamAngleDeg / 2) * Math.PI) / 180; const beamDiameterAtWorkplaneFt = 2 * netMountFt * Math.tan(halfBeamRad); const smhRatio = spacingFt / netMountFt; // Elevation above the workplane where adjacent 50%-intensity beam edges cross const crossoverAboveWorkplaneFt = Math.max( 0, netMountFt - spacingFt / (2 * Math.tan(halfBeamRad)) ); const totalWatts = fixtureCount * wattsPerFixture; const powerCordDropsNeeded = Math.ceil(fixtureCount / maxLinkablePerCord); return { netMountFt: Number(netMountFt.toFixed(1)), smhRatio: Number(smhRatio.toFixed(2)), beamDiameterAtWorkplaneFt: Number(beamDiameterAtWorkplaneFt.toFixed(1)), crossoverAboveWorkplaneFt: Number(crossoverAboveWorkplaneFt.toFixed(1)), amps120V: Number((totalWatts / 120).toFixed(2)), amps277V: Number((totalWatts / 277).toFixed(2)), nec15AContinuousPass: totalWatts <= 1440, // 80% of 1800W powerCordDropsNeeded, }; } You can test live 2D inverse-square foot-candle heatmaps for 14–40 ft warehouses in the High Bay Lighting Calculator and daisy-chain cord drops for 8–12 ft woodshops in the Shop Light Calculator.
4. Running-Bond 8×8×16 CMU Wall Deductions, Half-Blocks & Mortar Bags
A nominal 8" × 8" × 16" Concrete Masonry Unit (cinder block) actually measures 7-5/8" × 7-5/8" × 15-5/8". Once laid with a standard 3/8" Type S mortar bed and head joint, each block occupies exactly 8" × 16" (0.8889 sq ft), yielding the classic 9 / 8 = 1.125 blocks per square foot constant.
However, a practical masonry estimator also has to:
- Snap wall height to
8"course multiples (courses = ceil(heightIn / 8)), - Split alternating course ends into
8×8×8half-blocks (2half-blocks per alternating course per free end) so vertical head joints stay staggered by8", - Deduct window and door openings while adding
8"minimum lintel bearing on both jambs (lintelLengthIn = openingWidthIn + 16"), and - Compute face-shell
80-lbpremixed mortar bags (~3.35bags per100standard blocks before waste).
export function estimateCmuRunningBondWall({ lengthFt, heightFt, openingsSqFt = 0, freeEnds = 2, wastePct = 8, }: { lengthFt: number; heightFt: number; openingsSqFt?: number; freeEnds?: number; wastePct?: number; }) { const courses = Math.ceil((heightFt * 12) / 8); const grossSqFt = lengthFt * ((courses * 8) / 12); const netSqFt = Math.max(0, grossSqFt - openingsSqFt); const rawBlockEquivalents = Math.ceil(netSqFt * 1.125); const totalWithWaste = Math.ceil(rawBlockEquivalents * (1 + wastePct / 100)); const halfBlocks = Math.floor(courses / 2) * freeEnds; const fullStretchers = Math.max(0, totalWithWaste - Math.floor(halfBlocks / 2)); // Face-shell bedding uses ~3.35 80-lb bags per 100 nominal 8x8x16 blocks (+10% mixing waste) const mortarBags80lb = Math.ceil((totalWithWaste / 100) * 3.35 * 1.1); // Horizontal 9-gauge ladder wire every 2 courses (16" OC) in 10-ft strips (with 6" lap) const wireCourses = Math.floor((courses - 1) / 2); const ladderWire10ftStrips = Math.ceil((wireCourses * lengthFt) / 9.5); return { courses, netSqFt: Number(netSqFt.toFixed(1)), fullStretchers, halfBlocks, mortarBags80lb, ladderWire10ftStrips, }; } For full 2D running-bond wall elevations, lintel sizing, and downstream rebar cell grouting, see the Cinder Block Wall Calculator, CMU Block Fill Calculator, and Timber Retaining Wall Calculator.
Source & Reference Equations
All underlying carpentry, photometric, and masonry formulas are documented under the MIT license in kaiyilu/building-layout-math (live math reference). If you run into tricky edge cases—such as battered retaining wall setback offsets, asymmetric aisle-optic high bays, or sloped-grade fence stepping—feel free to drop a note in the comments!
