<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Felix Marlowe</title>
    <description>The latest articles on DEV Community by Felix Marlowe (@felixmarlowe).</description>
    <link>https://dev.to/felixmarlowe</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4269571%2Fed99a9f2-ffd5-4054-b06a-d3ed12a6ecad.png</url>
      <title>DEV Community: Felix Marlowe</title>
      <link>https://dev.to/felixmarlowe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/felixmarlowe"/>
    <language>en</language>
    <item>
      <title>Ray-Tracing Projector Shadows and 1-Inch EMT Deductions in Three.js for Home Golf Simulators</title>
      <dc:creator>Felix Marlowe</dc:creator>
      <pubDate>Fri, 27 Nov 2026 19:05:31 +0000</pubDate>
      <link>https://dev.to/felixmarlowe/ray-tracing-projector-shadows-and-1-inch-emt-deductions-in-threejs-for-home-golf-simulators-3kg8</link>
      <guid>https://dev.to/felixmarlowe/ray-tracing-projector-shadows-and-1-inch-emt-deductions-in-threejs-for-home-golf-simulators-3kg8</guid>
      <description>&lt;p&gt;Most DIY home golf simulator builds start with a tape measure in a two-car garage and end with two expensive surprises: a short-throw projector that casts the golfer's head shadow straight onto the impact screen, or an enclosure frame cut from 1-inch EMT conduit that comes out three inches too wide because nobody deducted steel corner slip-fitting insertion depths.&lt;/p&gt;

&lt;p&gt;While building &lt;a href="https://www.simbaycad.com/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=threejs_optics" rel="noopener noreferrer"&gt;SimBayCAD&lt;/a&gt;, I wanted to move those calculations out of fragile spreadsheets and into an interactive, deterministic Three.js studio that runs directly in the browser with zero signup. Here is how the optical ray-casting, biomechanical swing clearance model, and 1/16-inch EMT cut-list solver work in TypeScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Modeling Real Projector Optics (Throw Ratio + Vertical Lens Offset)
&lt;/h2&gt;

&lt;p&gt;A common misconception when hanging a short-throw golf simulator projector (such as a BenQ AK700ST or Optoma GT2000HDR) is assuming the lens aims straight horizontally at the center of the impact screen. In reality, fixed-offset short-throw lenses project upward (or downward when ceiling-mounted inverted) by a specific percentage of image height.&lt;/p&gt;

&lt;p&gt;For each of the 36 projectors in our hardware catalog, we store:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Native aspect ratio (&lt;code&gt;16:9&lt;/code&gt;, &lt;code&gt;16:10&lt;/code&gt;, or &lt;code&gt;4:3&lt;/code&gt;) and resolution&lt;/li&gt;
&lt;li&gt;Minimum and maximum throw ratio (&lt;code&gt;throwMin&lt;/code&gt;, &lt;code&gt;throwMax&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Vertical lens offset percentage (&lt;code&gt;offsetPct&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Ansi lumens and laser/lamp type&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Given a user's screen width &lt;code&gt;W&lt;/code&gt; and height &lt;code&gt;H&lt;/code&gt; (fitted inside their EMT enclosure with perimeter bungee clearance), the optical engine solves:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Valid throw corridor:&lt;/strong&gt; &lt;code&gt;minDist = W * throwMin&lt;/code&gt; to &lt;code&gt;maxDist = W * throwMax&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ceiling mount height and drop-pipe length:&lt;/strong&gt; Computed from the top of the projected image plus &lt;code&gt;offsetPct * H&lt;/code&gt; so the beam fills the impact screen cleanly without digital keystone distortion (which crops pixels and reduces brightness).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Garage door track clearance:&lt;/strong&gt; Compares the projector lens elevation and mounting bracket against standard 12-inch tracks, high-lift 4-inch drop tracks, or wall-mounted jackshaft openers so the garage door never clips the projector mount.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  2. Deterministic Golfer Shadow Intersection in 3D
&lt;/h2&gt;

&lt;p&gt;To flag projector shadows before anyone drills into drywall, the side-optics solver constructs the exact projection frustum from the ceiling mount point &lt;code&gt;(X_p, Y_p, Z_p)&lt;/code&gt; to the four corners of the impact screen, then tests ray intersections against a parametric golfer envelope positioned at the hitting strip &lt;code&gt;(X_tee, Y_tee)&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Address head height:&lt;/strong&gt; Scales with the selected golfer height (&lt;code&gt;5'4"&lt;/code&gt; to &lt;code&gt;6'6"&lt;/code&gt;), standing on the hitting mat thickness.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Driver swing apex arc:&lt;/strong&gt; Computes the backswing and follow-through arc radius for the longest club swung indoors (driver &lt;code&gt;45.5"&lt;/code&gt;, fairway wood, or iron), testing both ceiling clearance and rear/side wall impact margins.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When the ray from the projector lens to the top or middle of the screen intersects the golfer's head or downswing volume, SimBayCAD highlights the shadow line directly in the Three.js 3D viewport and side-optics elevation view, and recommends moving the mount forward (shorter throw lens) or adjusting tee offset.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Launch Monitor Sensor Zones: Radar vs. Photometric
&lt;/h2&gt;

&lt;p&gt;Different launch monitors impose completely different room-depth requirements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Behind-ball Doppler radar units&lt;/strong&gt; (Garmin Approach R10, FlightScope Mevo+, TrackMan 4) require 6 to 8 feet behind the tee plus 8 to 10+ feet of ball flight to the screen, pushing minimum room depth to 16-20 feet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Side-mounted photometric units&lt;/strong&gt; (Bushnell Launch Pro, GC3, SkyTrak+, Uneekor EYE MINI, Square Golf) read ball spin within inches of impact, allowing compact 10x12 and 12x16 garage builds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Overhead ceiling-mounted units&lt;/strong&gt; (Uneekor EYE XO, ProTee VX, TrackMan iO) require specific mounting zones 3 to 4 feet in front of the tee and clear of the projector beam.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SimBayCAD renders the exact radar/camera zone frustum on the floor and ceiling across 18 launch monitors so builders can compare right-handed, left-handed, and dual-handed off-center hitting strips before buying hardware.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Exact 1/16-Inch 1" EMT Cut Schedules and 10-ft Stick Nesting
&lt;/h2&gt;

&lt;p&gt;Home simulator enclosures are typically framed with standard 1-inch EMT electrical conduit (sold in 10-foot sticks at hardware stores) joined by steel 3-way and 4-way corner slip fittings. Two real-world dimensions break naive cut math:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Fitting insertion deductions:&lt;/strong&gt; Each steel corner connector adds &lt;code&gt;1.75"&lt;/code&gt; to &lt;code&gt;2.25"&lt;/code&gt; per joint depending on fitting style. Cutting pipes to outer bay width produces a frame that is up to 4 inches too wide.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;10-foot stick nesting:&lt;/strong&gt; Most width crossbars span 11 to 14 feet, requiring split spans with coupling sleeves and a center anti-sag depth rib.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Our pure-TypeScript BOM solver deducts every fitting depth down to &lt;code&gt;1/16"&lt;/code&gt;, splits long spans cleanly across standard 120-inch EMT sticks using a bin-packing nesting pass to minimize scrap conduit, and generates a 4-sheet printable PDF blueprint pack (&lt;code&gt;pdf-lib&lt;/code&gt; inside Cloudflare Workers) showing the full cut schedule, stick map, and ceiling mounting coordinates.&lt;/p&gt;

&lt;p&gt;You can test your own garage or basement dimensions, compare 36 projectors and 18 launch monitors, and share a build link directly at &lt;a href="https://www.simbaycad.com/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=threejs_optics" rel="noopener noreferrer"&gt;SimBayCAD&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>threejs</category>
      <category>typescript</category>
      <category>webdev</category>
      <category>svelte</category>
    </item>
    <item>
      <title>Building a Deterministic Fire-Code CAD Engine in TypeScript and Cloudflare Workers</title>
      <dc:creator>Felix Marlowe</dc:creator>
      <pubDate>Fri, 27 Nov 2026 19:04:00 +0000</pubDate>
      <link>https://dev.to/felixmarlowe/building-a-deterministic-fire-code-cad-engine-in-typescript-and-cloudflare-workers-4m53</link>
      <guid>https://dev.to/felixmarlowe/building-a-deterministic-fire-code-cad-engine-in-typescript-and-cloudflare-workers-4m53</guid>
      <description>&lt;p&gt;When an event producer or tent rental company pulls an operational fire permit for a 40x60 tent or a 200-guest hotel ballroom gala, the local fire marshal does not accept a rough sketch from Canva or Lucidchart. Inspectors check concrete numbers: occupant load under IFC Table 1004.5, minimum exit count and 72-inch tent exit widths under IFC Table 3103.11, the one-half diagonal exit remoteness rule, 36-inch and 44-inch clear egress aisles around banquet seating, 75-foot Class 2A:10BC fire extinguisher travel radii under NFPA 10, and minimum clearances for indirect-fired tent heaters (IFC 3107.12) and LP-gas tanks (IFC 3107.16).&lt;/p&gt;

&lt;p&gt;Most commercial CAD tools either cost hundreds of dollars a month, require desktop installation, or treat life-safety rules as manual drafting notes rather than executable geometry checks. While building &lt;a href="https://www.egresscad.com/?utm_source=hackernoon&amp;amp;utm_medium=article&amp;amp;utm_campaign=cad_workers" rel="noopener noreferrer"&gt;EgressCAD&lt;/a&gt;, I wanted to see how far a purely deterministic browser + Cloudflare Workers architecture could go: live 2D editing, real-time code auditing, and true architectural-scale 11x17 tabloid PDF + AutoCAD R12 DXF generation with zero external CAD backend.&lt;/p&gt;

&lt;p&gt;Here is how the geometry engine, code verifier, and vector exporters work in TypeScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Separating Pure Geometry from UI and Storage
&lt;/h2&gt;

&lt;p&gt;The first architectural decision was keeping every code formula, spatial calculation, and vector export in pure TypeScript modules with zero DOM or Node-native dependencies. That single constraint pays off in three ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Instant client-side feedback:&lt;/strong&gt; Dragging a 60-inch round table or shifting an exit door along a tent perimeter re-runs all nine IFC/NFPA compliance checks on every frame with zero round-trips.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Identical server verification:&lt;/strong&gt; The exact same TypeScript module runs inside the Cloudflare Worker when generating the final 3-sheet 11x17 PDF packet and layered DXF file, so what the user audits on screen is guaranteed to match the printed submittal byte for byte.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deterministic unit tests:&lt;/strong&gt; Every life-safety rule (including edge cases like the 1/3 diagonal sprinkler exception or LP-gas rack separation) can be tested directly against real municipal thresholds in milliseconds.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  2. Modeling IFC and NFPA Rules as Spatial Predicates
&lt;/h2&gt;

&lt;p&gt;Instead of treating a floor plan as loose shapes, EgressCAD stores typed spatial entities in feet from a &lt;code&gt;(0, 0)&lt;/code&gt; origin: structure bounds (enclosed tent, open canopy, indoor ballroom, outdoor fenced site), exit openings along perimeter edges, round/rectangular tables with explicit 18-inch chair pull-out rings, stages, bars, dance floors, portable extinguishers, indirect tent heaters, LP-gas cylinders, and generators.&lt;/p&gt;

&lt;p&gt;From that scene graph, the deterministic audit computes nine checks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Governing Occupant Load (IFC Table 1004.5):&lt;/strong&gt; Computes area-based load (&lt;code&gt;floorArea / loadFactor&lt;/code&gt;, using 15 sq ft/person for tables and chairs, 7 sq ft/person for concentrated seating, or 5 sq ft/person for standing space) and compares it against actual placed seat count, taking the governing maximum.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exit Count and Aggregate Width (IFC Table 3103.11 &amp;amp; 1005.3.2):&lt;/strong&gt; Verifies minimum exits by occupant bracket (e.g., 2 exits for 50-199 occupants in a tent, 3 exits for 200-499, 4 exits for 500-999), enforces the 72-inch minimum clear width for tent exits (36 inches for indoor doors), and checks total capacity at 0.2 inches per occupant.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exit Remoteness (IFC 1007.1.1):&lt;/strong&gt; Computes the Euclidean diagonal of the assembly area (&lt;code&gt;sqrt(W^2 + L^2)&lt;/code&gt;) and verifies the minimum pairwise separation between primary exits meets &lt;code&gt;0.5 * diagonal&lt;/code&gt; (or &lt;code&gt;0.33 * diagonal&lt;/code&gt; when the venue is fully sprinklered).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clear Aisle Widths:&lt;/strong&gt; Expands each banquet table radius by the 18-inch occupied chair pull-out envelope and verifies clearance between adjacent occupied rings and perimeter walls meets the 36-inch secondary and 44-inch main egress path minimums.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NFPA 10 Extinguisher Coverage:&lt;/strong&gt; Checks that every corner and interior grid sample of the structure lies within 75 feet of at least one 2A:10BC extinguisher, rendering dashed 75-ft coverage circles directly on the canvas and Sheet FP-101.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Winter Heating &amp;amp; LP-Gas Clearances (IFC 3107.12 &amp;amp; 3107.16):&lt;/strong&gt; When indirect heaters, propane tanks, or generators are placed outside a winter tent, checks the minimum 10-foot setback for heating equipment and 10-to-20-foot separation for LP-gas containers, and writes explicit code notes onto the submittal schedules.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. True-Scale 11x17 Tabloid PDFs Without a Headless Browser
&lt;/h2&gt;

&lt;p&gt;A common shortcut for web-to-PDF export is rasterizing an HTML canvas or spawning Puppeteer. Both break down on fire marshal submittals: raster images blur when inspectors zoom into dimensions, and headless Chrome cannot run inside a lightweight edge Worker.&lt;/p&gt;

&lt;p&gt;Instead, we generate vector PDFs directly in TypeScript using &lt;code&gt;pdf-lib&lt;/code&gt; on true ANSI B (&lt;code&gt;11" x 17"&lt;/code&gt;, or &lt;code&gt;1224 x 792 pt&lt;/code&gt;) landscape sheets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sheet FP-101 (Scaled Floor Plan):&lt;/strong&gt; Selects an exact architectural scale (&lt;code&gt;1/16" = 1'-0"&lt;/code&gt; or &lt;code&gt;1/8" = 1'-0"&lt;/code&gt; depending on venue footprint), maps feet directly to PDF points (&lt;code&gt;1 ft = 4.5 pt&lt;/code&gt; at &lt;code&gt;1/16"&lt;/code&gt; scale), draws crisp vector walls, exit arrows, dashed chair-pull-out rings, 75-ft extinguisher circles, graphic scale bar, north arrow, NFPA 170 legend, and a right-hand title block with jurisdiction, code edition, and &lt;code&gt;PASS (9/9)&lt;/code&gt; audit status.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sheet FP-102 (Code &amp;amp; Egress Calculation Schedule):&lt;/strong&gt; Tabulates every IFC/NFPA formula, input, required value, provided value, and pass/fail badge so the plan reviewer can verify the math in 30 seconds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sheet FP-103 (Site &amp;amp; Fire Access Plan):&lt;/strong&gt; Shows exterior fire-lane access, 10-ft/20-ft heater and LP-gas clearances, and generator setbacks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For free previews, the same generator overlays a tiled diagonal &lt;code&gt;DRAFT - NOT FOR PERMIT SUBMITTAL&lt;/code&gt; watermark across all three sheets and streams the PDF straight into an in-page preview modal via Blob URLs (avoiding mobile and desktop popup blockers). Paid packets strip the watermark and generate an accompanying AutoCAD R12 &lt;code&gt;.dxf&lt;/code&gt; file using clean ASCII &lt;code&gt;ENTITIES&lt;/code&gt; sections (&lt;code&gt;LINE&lt;/code&gt;, &lt;code&gt;CIRCLE&lt;/code&gt;, &lt;code&gt;LWPOLYLINE&lt;/code&gt;, &lt;code&gt;TEXT&lt;/code&gt;) organized onto standard layers (&lt;code&gt;A-WALL&lt;/code&gt;, &lt;code&gt;E-EXIT&lt;/code&gt;, &lt;code&gt;F-EXTG&lt;/code&gt;, &lt;code&gt;I-FURN&lt;/code&gt;, &lt;code&gt;A-ANNO&lt;/code&gt;) so architects or venue engineers can open it in AutoCAD, BricsCAD, or QCAD with zero translation cleanup.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Handling Local Municipal Guardrails Honestly
&lt;/h2&gt;

&lt;p&gt;One hard lesson in building compliance software is knowing where deterministic software stops and licensed professionals begin. Fire code thresholds vary sharply across US cities: Houston triggers tent permits above 1,200 sq ft, Austin and Los Angeles follow 400 sq ft enclosed / 700 sq ft open canopy rules, while Miami-Dade triggers permits at 120 sq ft under High-Velocity Hurricane Zone (HVHZ) wind rules.&lt;/p&gt;

&lt;p&gt;More importantly, seven major US jurisdictions (New York City, Chicago, Miami-Dade, Orlando, Tampa, Boston, and Washington, DC) require a licensed Professional Engineer (PE) or Registered Architect (RA) stamp on many temporary assembly filings. Rather than glossing over that, our 40-city permit directory and studio jurisdiction picker surface explicit PE/RA stamp notices upfront and position the DXF export as a clean scaled base file a licensed engineer can review and stamp rather than starting from scratch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pure TS engines shine on edge runtimes:&lt;/strong&gt; Running identical geometry and vector-PDF code in both the browser and Cloudflare Workers eliminates client/server drift and keeps infrastructure overhead near zero.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vector PDFs beat screenshots every time:&lt;/strong&gt; Mapping feet directly to PDF points (&lt;code&gt;pdf-lib&lt;/code&gt;) gives fire marshals razor-sharp architectural prints at exact &lt;code&gt;1/16" = 1'-0"&lt;/code&gt; scale in under 50 milliseconds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Single-session value beats gated trials:&lt;/strong&gt; Letting an event crew load a preset (like a 40x60 heated holiday tent), verify all 9 fire-code checks, and inspect the watermarked 3-sheet PDF before ever creating an account removes friction while showing exact engineering output upfront.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can try the interactive studio, city permit directory, and IFC calculators directly at &lt;a href="https://www.egresscad.com/?utm_source=hackernoon&amp;amp;utm_medium=article&amp;amp;utm_campaign=cad_workers" rel="noopener noreferrer"&gt;EgressCAD&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>cloudflare</category>
      <category>webdev</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
