Open-Source Residential & Commercial Field Equations

Building Layout Math: IES Photometrics & 2024 IRC Framing

Clean mathematical derivations and zero-drift tape-measure equations for ceiling lighting grids, IRC R312.1.3 deck & stair railings, IRC R507.5 structural drop beams, and equalized fence lines.

1. IES Zonal Cavity Ceiling Lighting & Obstruction Geometry

Dividing room area by bulb wattage ignores ceiling cavity absorption, wall reflectance, and beam cone overlap. The Illuminating Engineering Society (IES) Zonal Cavity method computes Room Cavity Ratio (RCR) first:

RCR = (5 * h_cavity * (Length + Width)) / (Length * Width)
h_cavity = Ceiling_Height - Workplane_Height
Fixtures_Required = ceil((Target_FC * Area_SqFt) / (Lumens_Per_Fixture * CU * LLF))
High_Bay_Beam_Diameter = 2 * h_cavity * tan(Beam_Angle_Deg / 2)
Space / Task Zone Workplane IES Target Illuminance Max S/MH Ratio
Bedroom / Living Room + Center Fan 2.5 ft 15 – 20 fc (160 – 215 lux) 1.20× mounting height
Kitchen Countertop & Prep Island 3.0 ft 40 – 50 fc (430 – 540 lux) 1.15× mounting height
2-Car Workshop Garage (4ft LED Strips) 3.0 ft 70 – 85 fc (750 – 915 lux) 1.40× mounting height
Auto Detailing Bay / Paint Correction 3.0 ft 110 – 150 fc (1,200+ lux) 1.25× mounting height
Warehouse / Pole Barn High-Bay (16–35 ft) 2.5 ft 30 – 50 fc (320 – 540 lux) 0.95 – 1.15× (90°/110° UFO crossover)

Interactive 2D Ceiling Blueprint & Heatmap Calculators

2. 2024 IRC R312.1.3 Guardrail, Stair Rake & R507.5 Framing Formulas

To eliminate cumulative spacer-block drift and pass municipal framing inspection under the 4-inch sphere rule (level rails) and 6-inch stair triangle rule, pull continuous leading-edge marks from inside post face 0":

Baluster_Count (N) = ceil((Clear_Span - Max_Gap) / (Baluster_Width + Max_Gap))
Exact_Horiz_Gap (g) = (Clear_Span - N * Baluster_Width) / (N + 1)
Horiz_Leading_Edge[i] = g + (i - 1) * (g + Baluster_Width)

// Angled Stair Rake (Unit Rise R, Unit Tread Run T, Pitch theta = atan(R / T)):
Sloped_Shoe_Rail_Mark[i] = Horiz_Leading_Edge[i] / cos(theta)
Spindle_Sloped_Footprint = Baluster_Width / cos(theta)
Framing Element Code Reference Field Rule / Formula
Deck & Porch Guardrail Pickets IRC R312.1.3 Clear opening < 4.00" (set target 3-5/8" to 3-3/4" for PT wood drying shrinkage)
Stair Tread–Riser–Rail Throat IRC R312.1.3 Exc. 2 Triangular throat must block a 6.00" sphere; open stair risers < 4.00"
Drop Beam End Cantilever IRC R507.5 Max overhang ≤ L / 4 of allowable post-to-post beam span
Privacy Fence Post Embedment Wind-Load Practice Hole depth ≥ 1/3 above-grade fence height + 4" tamped gravel base; 6 ft OC in high wind

Interactive 2D Carpentry & Structural Layout Calculators

3. IRC R404.4 & NCMA Retaining Wall, Gravel Compaction & CMU Core-Fill Math

Residential earth-retaining structures fail primarily from uncompacted footing trenches, skipped below-grade toe embedment, and hydrostatic clay pressure behind the wall face. Segmental retaining wall (SRW), 6×6 timber deadman, and ASTM C90 CMU takeoffs separate buried vs. exposed courses and dense road-base fines vs. clean angular stone:

Buried_Embedment_In = max(6, 0.10 * Exposed_Height_In)
Total_Courses = ceil(Exposed_Height_In / Block_H) + ceil(Buried_Embedment_In / Block_H)
Crusher_Run_Base_Tons = ((Length_Ft * (Trench_W_In / 12) * (Pad_D_In / 12) * 1.15) / 27) * 1.40
Clean_57_Drain_Tons   = ((Length_Ft * (Drain_W_In / 12) * Drain_H_Ft * 1.08) / 27) * 1.30
Geogrid_Embedment_Ft  = max(4.0, 0.70 * Total_Wall_Height_Ft) // Triggered > 48" footing-to-top or surcharge
Hardscape / Masonry Element Standard / Code Field Specification
Gravity Wall Permit Threshold IRC R404.4 ≤ 48" measured from bottom of leveling pad to top of cap (zero slope/driveway surcharge)
Leveling Trench vs. Drainage Zone NCMA SRW 6" compacted 3/4" minus crusher run in trench (+15% compaction); 12" washed #57 clean stone behind wall
6×6 Timber Deadman Tiebacks AWPA UC4B T-anchors every 6–8 ft OC; arm ≥ 1.0× wall height + 2.5 ft crosshead; 36" #4 rebar base pins
8×8×16 CMU Core Grout ASTM C90 / C476 0.235 ft³/block solid grouted (~0.87 yd³ raw per 100 blocks) + 3.2 bags Type S mortar / 100 blocks

Interactive 2D Hardscape, Timber & Masonry Takeoff Calculators

4. Run the Open-Source Reference CLI

Clone the repository from github.com/kaiyilu/building-layout-math and run node formulas.mjs to verify IES Zonal Cavity, stair spindle cosine projections, fence concrete displacement, and NCMA retaining wall takeoff math locally.