aldi-aros-hq-2027-civil-cad-bim-masterplan.html
<!--
Copyright © Albert Lane. All Rights Reserved.
Proprietary and Confidential — Albert Lane Proprietary Software License.
Unauthorized use, copying, or distribution is prohibited.
License inquiries: https://albertlane.net
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="copyright" content="© Albert Lane. All Rights Reserved. Albert Lane Proprietary Software License. https://albertlane.net" />
<title>ALDI™ & AR^OS™ HQ — 1 Other Hacker Sucks Ln | 2027 Civil CAD & BIM Masterplan</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet" />
<style>
:root {
--cad-bg: #070b14;
--cad-panel: #0b1120;
--cad-border: #1e293b;
--cad-cyan: #00f0ff;
--cad-emerald: #10b981;
--cad-amber: #f59e0b;
--cad-fuchsia: #e879f9;
--cad-rose: #f43f5e;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Inter', sans-serif;
background-color: var(--cad-bg);
color: #e2e8f0;
overflow-x: hidden;
}
.font-cad {
font-family: 'JetBrains Mono', monospace;
}
.cad-panel {
background: rgba(11, 17, 32, 0.94);
border: 1px solid rgba(30, 41, 59, 0.95);
}
.cad-glow {
box-shadow: 0 0 20px rgba(0, 240, 255, 0.12);
}
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: #070b14;
}
::-webkit-scrollbar-thumb {
background: #1e293b;
border-radius: 9999px;
}
</style>
</head>
<body class="min-h-screen flex flex-col bg-[#070b14] text-slate-100">
<!-- TOP CIVIL CAD WORKSTATION HEADER & TITLEBLOCK RIBBON -->
<header class="border-b border-slate-800 bg-[#080d19]/95 backdrop-blur px-3 sm:px-5 py-2.5 flex flex-wrap items-center justify-between gap-2 z-30">
<div class="flex items-center gap-3">
<div class="w-9 h-9 rounded-xl bg-cyan-500/15 border border-cyan-400/50 flex flex-col items-center justify-center font-cad font-bold text-[10px] leading-tight text-cyan-300 cad-glow">
<span>BIM</span>
<span class="text-[8px] text-emerald-400">2027</span>
</div>
<div>
<div class="flex items-center gap-2 flex-wrap">
<h1 class="text-xs sm:text-sm md:text-base font-extrabold tracking-tight text-white">
ALDI™ & AR^OS™ HQ — 1 OTHER HACKER SUCKS LN
</h1>
<span class="text-[10px] font-cad uppercase tracking-widest px-2 py-0.5 rounded bg-cyan-950/90 text-cyan-300 border border-cyan-500/40">
Z-AXIS CIVIL CAD v27.4
</span>
</div>
<p class="text-[11px] text-slate-400 hidden sm:block">
120.0m × 80.0m Suburban WFH Corporate Park • Parametric Grading, Structural Heuristics & AR^OS™ Fairway Circuit
</p>
</div>
</div>
<!-- TOOLBAR ACTIONS -->
<div class="flex flex-wrap items-center gap-2">
<div class="inline-flex rounded-xl bg-slate-900 p-1 border border-slate-800 text-[11px] font-cad">
<button id="btnSectionAA" onclick="setSectionCut('AA')" class="px-2.5 py-1 rounded-lg bg-cyan-400 text-slate-950 font-bold transition">
SEC A–A'
</button>
<button id="btnSectionBB" onclick="setSectionCut('BB')" class="px-2.5 py-1 rounded-lg text-slate-300 hover:text-white transition">
SEC B–B'
</button>
</div>
<button onclick="resetMasterplan()" class="px-3 py-1.5 rounded-xl text-xs font-cad bg-slate-900 hover:bg-slate-800 text-slate-200 border border-slate-700 transition">
↺ RESET SITE
</button>
<button onclick="exportCivilManifest()" class="px-3 py-1.5 rounded-xl text-xs font-cad font-bold bg-gradient-to-r from-cyan-400 to-emerald-400 text-slate-950 shadow hover:brightness-110 transition">
⬇ EXPORT CIVIL CAD JSON
</button>
</div>
</header>
<!-- MAIN 3-COLUMN WORKSTATION GRID -->
<main class="flex-1 grid grid-cols-1 lg:grid-cols-12 overflow-hidden">
<!-- LEFT SIDEBAR: CAD LAYERS & MODULE PLACEMENT PALETTE -->
<aside class="lg:col-span-3 border-b lg:border-b-0 lg:border-r border-slate-800 bg-[#090f1d] p-3.5 flex flex-col gap-3.5 overflow-y-auto max-h-[calc(100vh-110px)]">
<!-- 1. Toggleable Civil & BIM Layers -->
<div class="cad-panel rounded-xl p-3">
<div class="flex items-center justify-between mb-2">
<span class="text-[11px] font-cad uppercase tracking-wider text-cyan-400 font-bold">
1. Civil & BIM CAD Layers
</span>
<span class="text-[10px] font-cad text-slate-500">1.0m SNAP</span>
</div>
<div class="space-y-1.5 text-xs">
<label class="flex items-center justify-between p-1.5 rounded-lg bg-slate-900/80 hover:bg-slate-800/80 cursor-pointer border border-slate-800">
<span class="flex items-center gap-2">
<span class="w-2.5 h-2.5 rounded-full bg-amber-400"></span>
<span>Topographic Z-Contours</span>
</span>
<input type="checkbox" checked onchange="toggleLayer('contours', this.checked)" class="accent-cyan-400 rounded" />
</label>
<label class="flex items-center justify-between p-1.5 rounded-lg bg-slate-900/80 hover:bg-slate-800/80 cursor-pointer border border-slate-800">
<span class="flex items-center gap-2">
<span class="w-2.5 h-2.5 rounded-full bg-slate-300"></span>
<span>Foundations & Retaining Walls</span>
</span>
<input type="checkbox" checked onchange="toggleLayer('foundations', this.checked)" class="accent-cyan-400 rounded" />
</label>
<label class="flex items-center justify-between p-1.5 rounded-lg bg-slate-900/80 hover:bg-slate-800/80 cursor-pointer border border-slate-800">
<span class="flex items-center gap-2">
<span class="w-2.5 h-2.5 rounded-full bg-cyan-400"></span>
<span>Sub-Surface Utilities (10G / 480V)</span>
</span>
<input type="checkbox" checked onchange="toggleLayer('utilities', this.checked)" class="accent-cyan-400 rounded" />
</label>
<label class="flex items-center justify-between p-1.5 rounded-lg bg-slate-900/80 hover:bg-slate-800/80 cursor-pointer border border-slate-800">
<span class="flex items-center gap-2">
<span class="w-2.5 h-2.5 rounded-full bg-fuchsia-400"></span>
<span>Acoustic Isophones (dBA)</span>
</span>
<input type="checkbox" checked onchange="toggleLayer('acoustics', this.checked)" class="accent-cyan-400 rounded" />
</label>
<label class="flex items-center justify-between p-1.5 rounded-lg bg-slate-900/80 hover:bg-slate-800/80 cursor-pointer border border-slate-800">
<span class="flex items-center gap-2">
<span class="w-2.5 h-2.5 rounded-full bg-emerald-400"></span>
<span>Z-Axis Safety & ETFE Canopy</span>
</span>
<input type="checkbox" checked onchange="toggleLayer('safety', this.checked)" class="accent-cyan-400 rounded" />
</label>
</div>
</div>
<!-- 2. Interactive Civil & Architectural Placement Tool -->
<div class="cad-panel rounded-xl p-3">
<div class="flex items-center justify-between mb-1.5">
<span class="text-[11px] font-cad uppercase tracking-wider text-emerald-400 font-bold">
2. Place Civil / Park Modules
</span>
</div>
<p class="text-[11px] text-slate-400 mb-2">
Select a tool below, then click anywhere on the 120m × 80m floorplan to place, or drag existing nodes.
</p>
<div class="grid grid-cols-1 gap-1.5 text-xs">
<button id="tool-SELECT" onclick="selectTool('SELECT')" class="tool-btn flex items-center justify-between px-2.5 py-2 rounded-xl bg-cyan-500/20 text-cyan-200 border border-cyan-400 font-semibold">
<span>⌖ Inspect / Drag Spline Nodes</span>
<span class="text-[10px] font-cad">ESC</span>
</button>
<button id="tool-WFH_POD" onclick="selectTool('WFH_POD')" class="tool-btn flex items-center justify-between px-2.5 py-1.5 rounded-xl bg-slate-900 hover:bg-slate-800 text-slate-200 border border-slate-800">
<span>🏢 CLT WFH Focus Pod (14m²)</span>
<span class="text-[10px] font-cad text-emerald-400">+2.4m</span>
</button>
<button id="tool-SKATE_QP" onclick="selectTool('SKATE_QP')" class="tool-btn flex items-center justify-between px-2.5 py-1.5 rounded-xl bg-slate-900 hover:bg-slate-800 text-slate-200 border border-slate-800">
<span>🛹 Vert Quarter-Pipe (R=3.2m)</span>
<span class="text-[10px] font-cad text-cyan-400">+3.9m</span>
</button>
<button id="tool-LINKING_SPAN" onclick="selectTool('LINKING_SPAN')" class="tool-btn flex items-center justify-between px-2.5 py-1.5 rounded-xl bg-slate-900 hover:bg-slate-800 text-slate-200 border border-slate-800">
<span>🪵 LinkingLogs Glulam Bridge</span>
<span class="text-[10px] font-cad text-amber-400">4.6m</span>
</button>
<button id="tool-GRAFFITI_BAY" onclick="selectTool('GRAFFITI_BAY')" class="tool-btn flex items-center justify-between px-2.5 py-1.5 rounded-xl bg-slate-900 hover:bg-slate-800 text-slate-200 border border-slate-800">
<span>🎨 MicroLED Graffiti Glass Bay</span>
<span class="text-[10px] font-cad text-fuchsia-400">STC-52</span>
</button>
<button id="tool-ACOUSTIC_BERM" onclick="selectTool('ACOUSTIC_BERM')" class="tool-btn flex items-center justify-between px-2.5 py-1.5 rounded-xl bg-slate-900 hover:bg-slate-800 text-slate-200 border border-slate-800">
<span>⛰️ Earthwork Acoustic Berm</span>
<span class="text-[10px] font-cad text-amber-300">-8 dBA</span>
</button>
<button id="tool-BIOSWALE" onclick="selectTool('BIOSWALE')" class="tool-btn flex items-center justify-between px-2.5 py-1.5 rounded-xl bg-slate-900 hover:bg-slate-800 text-slate-200 border border-slate-800">
<span>💧 Stormwater Bioswale Basin</span>
<span class="text-[10px] font-cad text-sky-400">-0.9m</span>
</button>
</div>
</div>
<!-- 3. Earthwork & Concrete Summary Card -->
<div class="cad-panel rounded-xl p-3 font-cad text-[11px] space-y-1.5">
<div class="uppercase tracking-wider text-amber-400 font-bold">
3. Civil Earthwork & Concrete
</div>
<div class="flex justify-between">
<span class="text-slate-400">Bowl & Pit Cut Vol:</span>
<span id="hudCutVol" class="text-rose-300 font-bold">-1,420 m³</span>
</div>
<div class="flex justify-between">
<span class="text-slate-400">Berm & Fairway Fill:</span>
<span id="hudFillVol" class="text-emerald-300 font-bold">+1,390 m³</span>
</div>
<div class="flex justify-between border-t border-slate-800 pt-1">
<span class="text-slate-400">Net Grading Balance:</span>
<span id="hudNetEarth" class="text-cyan-300 font-bold">-30 m³ (98% Bal)</span>
</div>
<div class="flex justify-between">
<span class="text-slate-400">Shotcrete & Piers:</span>
<span id="hudConcreteVol" class="text-white font-bold">486 m³</span>
</div>
</div>
</aside>
<!-- CENTER VIEWPORT: 2D CAD MASTER FLOORPLAN + CROSS-SECTION ELEVATION -->
<section class="lg:col-span-6 flex flex-col bg-[#060a12] min-h-[540px]">
<!-- Top Coordinate Bar -->
<div class="px-3 py-1.5 bg-[#0a101f] border-b border-slate-800 flex flex-wrap items-center justify-between gap-2 text-[11px] font-cad">
<div class="flex items-center gap-3">
<span class="text-cyan-300 font-bold">PLAN VIEW: 120.0m × 80.0m</span>
<span id="cursorCoordReadout" class="text-slate-300">X: 060.0m | Y: 040.0m | Z: +0.00m</span>
</div>
<span id="activeToolBanner" class="text-emerald-400">MODE: INSPECT / DRAG KART SPLINE</span>
</div>
<!-- Main Floorplan Canvas -->
<div id="planCanvasWrap" class="relative flex-1 w-full min-h-[360px]">
<canvas id="cadPlanCanvas" class="block w-full h-full cursor-crosshair"></canvas>
<!-- Floating North Arrow & Scale Bar Overlay -->
<div class="absolute top-3 right-3 pointer-events-none bg-slate-950/85 border border-slate-800 rounded-xl px-2.5 py-1.5 text-[10px] font-cad text-slate-300 flex items-center gap-2">
<span>N ▲</span>
<span class="text-slate-600">|</span>
<span>GRID: 5m / 10m</span>
</div>
</div>
<!-- Bottom Cross-Section Elevation Profile Panel -->
<div class="h-44 border-t border-slate-800 bg-[#080d19] flex flex-col">
<div class="px-3 py-1 border-b border-slate-800/80 flex items-center justify-between text-[10px] font-cad">
<span id="sectionTitleLabel" class="text-amber-300 font-bold">
CROSS-SECTION A–A' (Y = 44.0m): SUNKEN VERT BOWL (-3.4m) → MICROLED GLASS (+4.5m) → WFH PODS (+3.2m)
</span>
<span class="text-slate-400">DATUM Z = 0.00m (NAVD88)</span>
</div>
<div class="relative flex-1 w-full">
<canvas id="sectionCanvas" class="block w-full h-full"></canvas>
</div>
</div>
</section>
<!-- RIGHT SIDEBAR: Z-AXIS MATHEMATICAL & CIVIL TELEMETRY INSPECTOR -->
<aside class="lg:col-span-3 border-t lg:border-t-0 lg:border-l border-slate-800 bg-[#090f1d] p-3.5 flex flex-col gap-3.5 overflow-y-auto max-h-[calc(100vh-110px)]">
<!-- 1. Global Campus Heuristics Gate -->
<div id="globalStatusCard" class="rounded-xl p-3 border bg-emerald-950/30 border-emerald-500/50">
<div class="flex items-center justify-between">
<span class="text-[10px] font-cad uppercase tracking-widest text-slate-400">Z-Axis Civil Gate</span>
<span id="globalStatusBadge" class="text-[10px] font-cad font-bold px-2 py-0.5 rounded bg-emerald-500 text-slate-950">
PERMIT READY
</span>
</div>
<div id="globalStatusTitle" class="text-sm font-extrabold text-emerald-300 mt-1">
ALL 6 ZONES PASS HEURISTICS
</div>
<p id="globalStatusDesc" class="text-[11px] text-slate-300 mt-0.5 leading-snug">
C1 skate transitions, LinkingLogs kern stability, kart superelevation & WFH pod <38 dBA verified.
</p>
</div>
<!-- 2. Selected Zone / Element Inspector -->
<div class="cad-panel rounded-xl p-3 space-y-2">
<div class="flex items-center justify-between">
<span class="text-[11px] font-cad uppercase tracking-wider text-cyan-400 font-bold">
Selected Element Inspector
</span>
<button id="btnDeleteSelected" onclick="deleteSelectedCustomModule()" class="hidden text-[10px] font-cad px-2 py-0.5 rounded bg-rose-500/20 text-rose-300 border border-rose-500/40 hover:bg-rose-500/30">
DELETE
</button>
</div>
<div id="inspectorHeader" class="p-2.5 rounded-lg bg-slate-950 border border-slate-800">
<div id="inspTitle" class="text-xs font-bold text-white">Zone 1: Vert & Flow Bowl Complex</div>
<div id="inspSub" class="text-[10px] font-cad text-cyan-300 mt-0.5">38m × 22m • Z = -3.4m to +4.0m</div>
</div>
<!-- Kart Node Banking Slider (Visible when a Kart Spline Node is selected) -->
<div id="kartNodeControls" class="hidden p-2.5 rounded-lg bg-slate-950 border border-amber-500/40 space-y-1.5">
<div class="flex justify-between text-[11px] font-cad">
<span class="text-amber-300">Superelevation Bank (θ):</span>
<strong id="inspBankVal" class="text-white">16°</strong>
</div>
<input id="inspBankSlider" type="range" min="0" max="30" value="16" oninput="updateSelectedKartNodeBank(this.value)" class="w-full accent-amber-400 cursor-pointer" />
</div>
<!-- Live Mathematical Equations & Metrics -->
<div id="inspMathList" class="space-y-1.5 text-[11px] font-cad"></div>
</div>
<!-- 3. Real-Time Civic Engineering Diagnostics Feed -->
<div class="cad-panel rounded-xl p-3 flex-1 flex flex-col min-h-[150px]">
<div class="text-[11px] font-cad uppercase tracking-wider text-slate-400 font-bold mb-2">
Live Z-Axis Engineering Audit
</div>
<div id="auditLogList" class="space-y-1.5 text-[11px] font-cad overflow-y-auto flex-1"></div>
</div>
<!-- CAD Drawing Titleblock Stamp -->
<div class="rounded-xl bg-slate-950 border border-slate-800 p-2.5 font-cad text-[10px] text-slate-400 space-y-0.5">
<div class="flex justify-between text-slate-200 font-bold">
<span>CLIENT: ALDI™ & AR^OS™</span>
<span>SHEET: C-101</span>
</div>
<div>SITE: 1 OTHER HACKER SUCKS LN</div>
<div class="text-cyan-400/90">© Albert Lane. All Rights Reserved. | albertlane.net</div>
</div>
</aside>
</main>
<!-- NOTIFICATION TOAST -->
<div id="toastBanner" class="hidden fixed bottom-4 right-4 z-50 px-4 py-2.5 rounded-xl bg-slate-900 border border-cyan-400 text-xs font-cad text-cyan-200 shadow-2xl"></div>
<script>
// =========================================================================
// COPYRIGHT © ALBERT LANE. ALL RIGHTS RESERVED.
// PROPRIETARY AND CONFIDENTIAL — ALBERT LANE PROPRIETARY SOFTWARE LICENSE.
// UNAUTHORIZED USE, COPYING, OR DISTRIBUTION IS PROHIBITED.
// LICENSE INQUIRIES: https://albertlane.net
// =========================================================================
const SITE_W = 120.0; // meters (East-West X)
const SITE_H = 80.0; // meters (North-South Y, where Y=0 is North ridge, Y=80 is South entry)
const GRAVITY = 9.80665;
const TIRE_MU = 0.85;
// Master State
const state = {
layers: {
contours: true,
foundations: true,
utilities: true,
acoustics: true,
safety: true
},
activeTool: 'SELECT',
sectionCut: 'AA', // 'AA' (horizontal Y=44m) or 'BB' (vertical X=48m)
selectedEntity: { kind: 'ZONE', id: 'ZONE_1' },
draggingKartNodeIdx: -1,
hoverPos: { x: 60, y: 40 },
baseZones: [],
kartNodes: [],
kartSpline: [],
customModules: [],
metrics: {
cutVol: 1420,
fillVol: 1390,
concreteVol: 486,
minKartRadius: 14.5,
maxPodNoiseDba: 36.4,
errors: [],
warnings: []
}
};
// Initial Masterplan Zones (120m x 80m Campus Parcel)
function initDefaultSite() {
state.baseZones = [
{
id: 'ZONE_1',
name: 'Zone 1: Vert & Flow Bowl Skate Complex',
shortLabel: 'ZONE 1: VERT & FLOW BOWL (z=-3.4m to +4.0m)',
x: 6, y: 48, w: 38, h: 24,
zMin: -3.4, zMax: 4.0,
color: '#00f0ff',
cutM3: 980, fillM3: 120, concreteM3: 245,
sourceSplDb: 95.0,
specs: {
'Transition Radius R': '3.20 m (13ft Vert)',
'Entry Design Speed': '11.0 m/s (24.6 MPH)',
'Peak Normal Load G': '1 + v²/(gR) = 2.86 G (≤ 3.2G)',
'Beamforming Audio': '6× Phased Line Arrays (95 dB)'
}
},
{
id: 'ZONE_2',
name: 'Zone 2: Hydraulic Modular Street Plaza',
shortLabel: 'ZONE 2: MODULAR STREET PLAZA (24m×18m)',
x: 48, y: 50, w: 26, h: 20,
zMin: 0.0, zMax: 1.4,
color: '#38bdf8',
cutM3: 160, fillM3: 90, concreteM3: 112,
sourceSplDb: 82.0,
specs: {
'Hydraulic Grid Nodes': '96× 24VDC Actuators (50 kN)',
'C0 Seam Lip Tolerance': '≤ 2.0 mm (Wheel-Stop Gate)',
'C1 Slope Continuity': '≤ 0.035 rad (2.0°)',
'OT VLAN Control': '10.27.0.0/16 CAN-FD Interlock'
}
},
{
id: 'ZONE_3',
name: 'Zone 3: LinkingLogs Engineering Sandbox',
shortLabel: 'ZONE 3: LINKINGLOGS PIT (20m×16m)',
x: 6, y: 27, w: 22, h: 17,
zMin: -0.15, zMax: 3.2,
color: '#f59e0b',
cutM3: 110, fillM3: 40, concreteM3: 28,
sourceSplDb: 74.0,
specs: {
'Glulam Timber Grade': 'ANSI A190.1 24F-V4 (E = 12.4 GPa)',
'Euler-Bernoulli Defl.': 'δ_max = 8.4 mm ≤ L/360 (11.7 mm)',
'Bending Safety Factor': 'FoS = 3.12 (≥ 2.50 Required)',
'Kern Tipping Check': 'CoG Inside Middle-Third Polygon'
}
},
{
id: 'ZONE_4',
name: 'Zone 4: Digital Graffiti MicroLED Glass Spine',
shortLabel: 'ZONE 4: DIGITAL GRAFFITI GLASS SPINE (STC-52)',
x: 32, y: 31, w: 46, h: 5,
zMin: 0.0, zMax: 4.5,
color: '#e879f9',
cutM3: 45, fillM3: 20, concreteM3: 36,
sourceSplDb: 68.0,
specs: {
'Glazing Assembly': '8mm Low-Iron / 1.52mm SentryGlas / MicroLED',
'Acoustic Isolation': 'STC-52 Barrier (-34 dB Insertion Loss)',
'Optical Transparency': '84% @ 4,500 Nits Peak Brightness',
'Telemetry Latency': '6-DoF UWB + 1000Hz IMU (< 8 ms)'
}
},
{
id: 'ZONE_5',
name: 'Zone 5: Suburban WFH Acoustic Focus Pods (18×)',
shortLabel: 'ZONE 5: 18× WFH FOCUS PODS (<38 dBA)',
x: 24, y: 6, w: 62, h: 18,
zMin: 1.2, zMax: 3.2,
color: '#10b981',
cutM3: 65, fillM3: 240, concreteM3: 65,
sourceSplDb: 35.0,
specs: {
'Pod Count & Footprint': '18× CLT Pods @ 14 m² Each (252 m²)',
'Pier Elevation Range': 'z = +1.2m to +3.2m Neoprene Isolated',
'Acoustic Target': '≤ 38.0 dBA Ambient During Bowl Session',
'Civic Backbone': 'Dual-Redundant 10 Gbps Fiber Ring'
}
}
];
// Outer Fairway Electric Go-Kart Circuit (Zone 6)
state.kartNodes = [
{ x: 80, y: 56, bankDeg: 10 },
{ x: 108, y: 64, bankDeg: 20 },
{ x: 112, y: 38, bankDeg: 22 },
{ x: 102, y: 14, bankDeg: 18 },
{ x: 92, y: 28, bankDeg: 14 },
{ x: 84, y: 42, bankDeg: 12 }
];
state.customModules = [];
state.selectedEntity = { kind: 'ZONE', id: 'ZONE_1' };
recomputeEngineeringModel();
}
// =========================================================================
// MATHEMATICAL & CIVIL ENGINEERING HEURISTICS ENGINE
// =========================================================================
function catmullRom(p0, p1, p2, p3, t) {
const t2 = t * t;
const t3 = t2 * t;
return {
x: 0.5 * ((2 * p1.x) + (-p0.x + p2.x) * t + (2 * p0.x - 5 * p1.x + 4 * p2.x - p3.x) * t2 + (-p0.x + 3 * p1.x - 3 * p2.x + p3.x) * t3),
y: 0.5 * ((2 * p1.y) + (-p0.y + p2.y) * t + (2 * p0.y - 5 * p1.y + 4 * p2.y - p3.y) * t2 + (-p0.y + 3 * p1.y - 3 * p2.y + p3.y) * t3)
};
}
function recomputeEngineeringModel() {
// 1. Rebuild Catmull-Rom spline for Zone 6 AR^OS™ Go-Kart Circuit
const nodes = state.kartNodes;
const n = nodes.length;
const samples = [];
const steps = 28;
for (let i = 0; i < n; i++) {
const p0 = nodes[(i - 1 + n) % n];
const p1 = nodes[i];
const p2 = nodes[(i + 1) % n];
const p3 = nodes[(i + 2) % n];
for (let s = 0; s < steps; s++) {
const t = s / steps;
const pt = catmullRom(p0, p1, p2, p3, t);
const bankDeg = p1.bankDeg * (1 - t) + p2.bankDeg * t;
samples.push({ x: pt.x, y: pt.y, bankDeg, bankRad: (bankDeg * Math.PI) / 180, radius: 100 });
}
}
let minKartR = Infinity;
let totalKartLen = 0;
for (let i = 0; i < samples.length; i++) {
const prev = samples[(i - 1 + samples.length) % samples.length];
const curr = samples[i];
const next = samples[(i + 1) % samples.length];
totalKartLen += Math.hypot(curr.x - prev.x, curr.y - prev.y);
const ax = curr.x - prev.x, ay = curr.y - prev.y;
const bx = next.x - curr.x, by = next.y - curr.y;
const cx = next.x - prev.x, cy = next.y - prev.y;
const a = Math.hypot(ax, ay) || 0.01;
const b = Math.hypot(bx, by) || 0.01;
const c = Math.hypot(cx, cy) || 0.01;
const area2 = Math.abs(ax * by - ay * bx);
const kappa = (2 * area2) / (a * b * c);
const R = kappa > 0.004 ? Math.min(200, 1 / kappa) : 200;
curr.radius = R;
if (R < minKartR) minKartR = R;
}
state.kartSpline = samples;
state.metrics.minKartRadius = minKartR;
state.metrics.totalKartLen = totalKartLen;
// 2. Calculate Cut/Fill Earthwork & Concrete Volumes
let cut = 0;
let fill = Math.round(totalKartLen * 4.2); // Fairway kart sub-base & superelevation fill
let concrete = Math.round(totalKartLen * 0.35);
state.baseZones.forEach(z => {
cut += z.cutM3;
fill += z.fillM3;
concrete += z.concreteM3;
});
state.customModules.forEach(m => {
cut += m.cutM3 || 0;
fill += m.fillM3 || 0;
concrete += m.concreteM3 || 0;
});
state.metrics.cutVol = cut;
state.metrics.fillVol = fill;
state.metrics.concreteVol = concrete;
// 3. Acoustic Propagation Check at WFH Focus Pods (Zone 5 + Custom WFH Pods)
const errors = [];
const warnings = [];
const podTargets = [
{ name: 'Zone 5 North WFH Grove', x: 52, y: 24 },
...state.customModules.filter(m => m.type === 'WFH_POD').map(m => ({ name: m.label, x: m.x, y: m.y }))
];
// Acoustic berms & Graffiti Glass Spine add transmission loss
const bermCount = state.customModules.filter(m => m.type === 'ACOUSTIC_BERM').length;
const extraGraffitiCount = state.customModules.filter(m => m.type === 'GRAFFITI_BAY').length;
let worstPodDba = 32.0;
podTargets.forEach(pod => {
// Distance to Zone 1 Bowl center (25, 60) where 95 dB beamforming array operates
const distBowl = Math.max(5, Math.hypot(pod.x - 25, pod.y - 60));
// Beamforming directivity (-32 dB off-axis) + geometric spreading 20*log10(d) + Graffiti Glass STC-52 (-18 dB diffraction)
const geoLoss = 20 * Math.log10(distBowl);
const barrierLoss = 18.0 + bermCount * 2.5 + extraGraffitiCount * 1.5;
const arrivalSpl = 95.0 - 24.0 - geoLoss - barrierLoss;
if (arrivalSpl > worstPodDba) worstPodDba = arrivalSpl;
if (arrivalSpl > 38.0) {
errors.push(`${pod.name} receives ${arrivalSpl.toFixed(1)} dBA (> 38.0 dBA WFH limit) — move north or add Acoustic Berm.`);
}
});
state.metrics.maxPodNoiseDba = worstPodDba;
// 4. Kart Circuit Curvature & WFH Pod Standoff Check
if (minKartR < 8.5) {
errors.push(`AR^OS™ Kart circuit corner radius R_min = ${minKartR.toFixed(1)}m (< 8.5m safe turning radius).`);
}
const zone5 = state.baseZones.find(z => z.id === 'ZONE_5');
let minKartPodDist = Infinity;
samples.forEach(pt => {
const cx = Math.max(zone5.x, Math.min(zone5.x + zone5.w, pt.x));
const cy = Math.max(zone5.y, Math.min(zone5.y + zone5.h, pt.y));
const d = Math.hypot(pt.x - cx, pt.y - cy);
if (d < minKartPodDist) minKartPodDist = d;
});
if (minKartPodDist < 6.0) {
errors.push(`Kart track outer edge is ${minKartPodDist.toFixed(1)}m from WFH Pods (minimum 6.0m runoff buffer).`);
}
if (Math.abs(cut - fill) > 350) {
warnings.push(`Net earthwork imbalance of ${fill - cut > 0 ? '+' : ''}${fill - cut} m³ — add Acoustic Berms or Bioswales to balance on-site.`);
}
state.metrics.errors = errors;
state.metrics.warnings = warnings;
updateRightSidebarUI();
}
// =========================================================================
// UI UPDATES & TELEMETRY INSPECTOR
// =========================================================================
function updateRightSidebarUI() {
const { cutVol, fillVol, concreteVol, errors, warnings } = state.metrics;
const net = fillVol - cutVol;
const balancePct = Math.max(0, Math.round(100 - (Math.abs(net) / Math.max(1, cutVol)) * 100));
document.getElementById('hudCutVol').textContent = `-${cutVol.toLocaleString()} m³`;
document.getElementById('hudFillVol').textContent = `+${fillVol.toLocaleString()} m³`;
document.getElementById('hudNetEarth').textContent = `${net >= 0 ? '+' : ''}${net} m³ (${balancePct}% Bal)`;
document.getElementById('hudConcreteVol').textContent = `${concreteVol.toLocaleString()} m³`;
const statusCard = document.getElementById('globalStatusCard');
const statusBadge = document.getElementById('globalStatusBadge');
const statusTitle = document.getElementById('globalStatusTitle');
const statusDesc = document.getElementById('globalStatusDesc');
if (errors.length === 0) {
statusCard.className = 'rounded-xl p-3 border bg-emerald-950/30 border-emerald-500/50';
statusBadge.className = 'text-[10px] font-cad font-bold px-2 py-0.5 rounded bg-emerald-500 text-slate-950';
statusBadge.textContent = 'PERMIT READY';
statusTitle.className = 'text-sm font-extrabold text-emerald-300 mt-1';
statusTitle.textContent = 'ALL 6 ZONES PASS HEURISTICS';
statusDesc.textContent = `C1 transitions, LinkingLogs kern, Kart R_min=${state.metrics.minKartRadius.toFixed(1)}m & WFH Pods (${state.metrics.maxPodNoiseDba.toFixed(1)} dBA) verified.`;
} else {
statusCard.className = 'rounded-xl p-3 border bg-rose-950/40 border-rose-500/60';
statusBadge.className = 'text-[10px] font-cad font-bold px-2 py-0.5 rounded bg-rose-500 text-white';
statusBadge.textContent = 'HOLD / REVISE';
statusTitle.className = 'text-sm font-extrabold text-rose-300 mt-1';
statusTitle.textContent = `${errors.length} CIVIC / SAFETY VIOLATION(S)`;
statusDesc.textContent = 'Resolve highlighted clearance, acoustic, or curvature alerts below.';
}
const auditList = document.getElementById('auditLogList');
if (errors.length === 0 && warnings.length === 0) {
auditList.innerHTML = `
<div class="p-2 rounded bg-emerald-950/30 border border-emerald-500/30 text-emerald-300">
✓ Earthwork cut/fill balanced within 95%+ site retention threshold.
</div>
<div class="p-2 rounded bg-cyan-950/30 border border-cyan-500/30 text-cyan-200">
✓ WFH Grove peak ambient noise: ${state.metrics.maxPodNoiseDba.toFixed(1)} dBA (≤ 38.0 dBA).
</div>
`;
} else {
auditList.innerHTML = [
...errors.map(e => `<div class="p-2 rounded bg-rose-950/40 border border-rose-500/50 text-rose-200">ERR: ${e}</div>`),
...warnings.map(w => `<div class="p-2 rounded bg-amber-950/30 border border-amber-500/40 text-amber-200">WARN: ${w}</div>`)
].join('');
}
refreshInspectorPanel();
}
function refreshInspectorPanel() {
const sel = state.selectedEntity;
const titleEl = document.getElementById('inspTitle');
const subEl = document.getElementById('inspSub');
const mathList = document.getElementById('inspMathList');
const delBtn = document.getElementById('btnDeleteSelected');
const kartCtrl = document.getElementById('kartNodeControls');
delBtn.classList.add('hidden');
kartCtrl.classList.add('hidden');
if (sel.kind === 'ZONE') {
const z = state.baseZones.find(item => item.id === sel.id) || state.baseZones[0];
titleEl.textContent = z.name;
subEl.textContent = `${z.w}m × ${z.h}m (${z.w * z.h} m²) • Z = ${z.zMin >= 0 ? '+' : ''}${z.zMin}m to +${z.zMax}m`;
mathList.innerHTML = Object.entries(z.specs)
.map(([k, v]) => `
<div class="p-2 rounded-lg bg-slate-950 border border-slate-800 flex justify-between gap-2">
<span class="text-slate-400">${k}:</span>
<span class="text-slate-100 font-semibold text-right">${v}</span>
</div>
`).join('');
} else if (sel.kind === 'KART_NODE') {
const idx = sel.idx;
const node = state.kartNodes[idx];
if (!node) return;
kartCtrl.classList.remove('hidden');
document.getElementById('inspBankVal').textContent = `${node.bankDeg}°`;
document.getElementById('inspBankSlider').value = node.bankDeg;
// Calculate ideal superelevation at v = 18 m/s (40 MPH)
const localR = state.metrics.minKartRadius;
const tanT = Math.tan((node.bankDeg * Math.PI) / 180);
const vMaxMps = Math.sqrt((GRAVITY * localR * (tanT + TIRE_MU)) / Math.max(0.2, 1 - TIRE_MU * tanT));
titleEl.textContent = `Zone 6: AR^OS™ Kart Spline Node #${idx + 1}`;
subEl.textContent = `Coord (${node.x.toFixed(1)}m, ${node.y.toFixed(1)}m) • Track Len: ${Math.round(state.metrics.totalKartLen)}m`;
mathList.innerHTML = `
<div class="p-2 rounded-lg bg-slate-950 border border-slate-800 flex justify-between">
<span class="text-slate-400">Superelevation θ:</span>
<span class="text-amber-300 font-bold">${node.bankDeg}° (${((node.bankDeg * Math.PI) / 180).toFixed(3)} rad)</span>
</div>
<div class="p-2 rounded-lg bg-slate-950 border border-slate-800 flex justify-between">
<span class="text-slate-400">Circuit Min Radius R:</span>
<span class="text-cyan-300 font-bold">${localR.toFixed(1)} m</span>
</div>
<div class="p-2 rounded-lg bg-slate-950 border border-slate-800 flex justify-between">
<span class="text-slate-400">Max Non-Skid Apex V:</span>
<span class="text-emerald-300 font-bold">${(vMaxMps * 2.23694).toFixed(1)} MPH</span>
</div>
<div class="p-2 rounded-lg bg-slate-950 border border-slate-800 text-[10px] text-slate-400">
Formula: V_max = √[ g·R·(tan θ + μ) / (1 − μ·tan θ) ]
</div>
`;
} else if (sel.kind === 'CUSTOM') {
const mod = state.customModules.find(m => m.uid === sel.uid);
if (!mod) return;
delBtn.classList.remove('hidden');
titleEl.textContent = mod.label;
subEl.textContent = `Placed @ (${mod.x.toFixed(1)}m, ${mod.y.toFixed(1)}m) • Z = ${mod.zElev >= 0 ? '+' : ''}${mod.zElev}m`;
mathList.innerHTML = Object.entries(mod.specs)
.map(([k, v]) => `
<div class="p-2 rounded-lg bg-slate-950 border border-slate-800 flex justify-between gap-2">
<span class="text-slate-400">${k}:</span>
<span class="text-slate-100 font-semibold text-right">${v}</span>
</div>
`).join('');
}
}
function updateSelectedKartNodeBank(val) {
if (state.selectedEntity.kind !== 'KART_NODE') return;
state.kartNodes[state.selectedEntity.idx].bankDeg = Number(val);
recomputeEngineeringModel();
renderAll();
}
function deleteSelectedCustomModule() {
if (state.selectedEntity.kind !== 'CUSTOM') return;
state.customModules = state.customModules.filter(m => m.uid !== state.selectedEntity.uid);
state.selectedEntity = { kind: 'ZONE', id: 'ZONE_1' };
recomputeEngineeringModel();
renderAll();
}
// =========================================================================
// CANVAS RENDERING: 2D CAD MASTER FLOORPLAN + A-A' / B-B' CROSS-SECTION
// =========================================================================
function getPlanTransform(canvas) {
const rect = canvas.getBoundingClientRect();
const pad = 28;
const scale = Math.min((rect.width - pad * 2) / SITE_W, (rect.height - pad * 2) / SITE_H);
const ox = (rect.width - SITE_W * scale) / 2;
const oy = (rect.height - SITE_H * scale) / 2;
return { scale, ox, oy, W: rect.width, H: rect.height };
}
function renderPlanCanvas() {
const canvas = document.getElementById('cadPlanCanvas');
if (!canvas) return;
const rect = canvas.getBoundingClientRect();
if (rect.width === 0 || rect.height === 0) return;
const dpr = window.devicePixelRatio || 1;
canvas.width = Math.floor(rect.width * dpr);
canvas.height = Math.floor(rect.height * dpr);
const ctx = canvas.getContext('2d');
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
const t = getPlanTransform(canvas);
// 1. Deep Blueprint Background
ctx.fillStyle = '#060a12';
ctx.fillRect(0, 0, t.W, t.H);
// Parcel Property Boundary (120m x 80m)
ctx.fillStyle = '#09111e';
ctx.strokeStyle = '#334155';
ctx.lineWidth = 2;
ctx.fillRect(t.ox, t.oy, SITE_W * t.scale, SITE_H * t.scale);
ctx.strokeRect(t.ox, t.oy, SITE_W * t.scale, SITE_H * t.scale);
// 5m & 10m Architectural Survey Grid
for (let x = 0; x <= SITE_W; x += 5) {
ctx.strokeStyle = x % 10 === 0 ? 'rgba(56, 189, 248, 0.14)' : 'rgba(30, 41, 59, 0.45)';
ctx.lineWidth = x % 10 === 0 ? 1 : 0.6;
ctx.beginPath();
ctx.moveTo(t.ox + x * t.scale, t.oy);
ctx.lineTo(t.ox + x * t.scale, t.oy + SITE_H * t.scale);
ctx.stroke();
}
for (let y = 0; y <= SITE_H; y += 5) {
ctx.strokeStyle = y % 10 === 0 ? 'rgba(56, 189, 248, 0.14)' : 'rgba(30, 41, 59, 0.45)';
ctx.lineWidth = y % 10 === 0 ? 1 : 0.6;
ctx.beginPath();
ctx.moveTo(t.ox, t.oy + y * t.scale);
ctx.lineTo(t.ox + SITE_W * t.scale, t.oy + y * t.scale);
ctx.stroke();
}
// 2. Layer: Topographic Z-Contours
if (state.layers.contours) {
ctx.save();
ctx.strokeStyle = 'rgba(245, 158, 11, 0.24)';
ctx.lineWidth = 1;
// Sunken Bowl Contours (-1m, -2m, -3m)
[16, 12, 8].forEach((rx, idx) => {
ctx.beginPath();
ctx.ellipse(t.ox + 25 * t.scale, t.oy + 60 * t.scale, rx * t.scale, rx * 0.58 * t.scale, 0, 0, Math.PI * 2);
ctx.stroke();
ctx.fillStyle = 'rgba(245, 158, 11, 0.55)';
ctx.font = '8px "JetBrains Mono", monospace';
ctx.fillText(`-${idx + 1}.0m`, t.ox + (25 + rx) * t.scale + 2, t.oy + 60 * t.scale);
});
// North Ridge Contours (+1m, +2m)
[1, 2].forEach(elev => {
ctx.beginPath();
ctx.moveTo(t.ox + 4 * t.scale, t.oy + (26 - elev * 8) * t.scale);
ctx.quadraticCurveTo(t.ox + 60 * t.scale, t.oy + (22 - elev * 7) * t.scale, t.ox + 116 * t.scale, t.oy + (28 - elev * 8) * t.scale);
ctx.stroke();
});
ctx.restore();
}
// 3. Layer: Acoustic Attenuation Isophones (dBA)
if (state.layers.acoustics) {
ctx.save();
const bowlX = t.ox + 25 * t.scale;
const bowlY = t.oy + 60 * t.scale;
const rings = [
{ r: 16, label: '85 dBA', col: 'rgba(244, 63, 94, 0.25)' },
{ r: 28, label: '68 dBA', col: 'rgba(232, 121, 249, 0.20)' },
{ r: 42, label: '48 dBA', col: 'rgba(56, 189, 248, 0.16)' },
{ r: 54, label: '37 dBA', col: 'rgba(16, 185, 129, 0.18)' }
];
rings.forEach(ring => {
ctx.strokeStyle = ring.col;
ctx.setLineDash([5, 4]);
ctx.lineWidth = 1.3;
ctx.beginPath();
ctx.arc(bowlX, bowlY, ring.r * t.scale, 0, Math.PI * 2);
ctx.stroke();
ctx.fillStyle = 'rgba(232, 121, 249, 0.75)';
ctx.font = '8px "JetBrains Mono", monospace';
ctx.fillText(ring.label, bowlX + ring.r * t.scale * 0.7, bowlY - ring.r * t.scale * 0.7);
});
ctx.setLineDash([]);
ctx.restore();
}
// 4. Base Architectural & Engineering Zones (Zones 1 - 5)
state.baseZones.forEach(z => {
const zx = t.ox + z.x * t.scale;
const zy = t.oy + z.y * t.scale;
const zw = z.w * t.scale;
const zh = z.h * t.scale;
const isSel = state.selectedEntity.kind === 'ZONE' && state.selectedEntity.id === z.id;
ctx.save();
ctx.fillStyle = z.color + (isSel ? '2e' : '18');
ctx.strokeStyle = isSel ? '#ffffff' : z.color;
ctx.lineWidth = isSel ? 2.4 : 1.5;
ctx.fillRect(zx, zy, zw, zh);
ctx.strokeRect(zx, zy, zw, zh);
// Layer: Structural Foundations / Pier Grid inside Zone
if (state.layers.foundations) {
ctx.fillStyle = 'rgba(226, 232, 240, 0.45)';
for (let px = z.x + 3; px < z.x + z.w - 1; px += 6) {
for (let py = z.y + 3; py < z.y + z.h - 1; py += 6) {
ctx.fillRect(t.ox + px * t.scale - 1.5, t.oy + py * t.scale - 1.5, 3, 3);
}
}
}
// Special Detail for Zone 5: 18 Individual Cantilevered CLT WFH Focus Pods
if (z.id === 'ZONE_5') {
ctx.fillStyle = 'rgba(16, 185, 129, 0.35)';
ctx.strokeStyle = '#34d399';
ctx.lineWidth = 1;
for (let row = 0; row < 2; row++) {
for (let col = 0; col < 9; col++) {
const podX = t.ox + (z.x + 2.5 + col * 6.5) * t.scale;
const podY = t.oy + (z.y + 3 + row * 8.5) * t.scale;
ctx.fillRect(podX, podY, 4.2 * t.scale, 3.4 * t.scale);
ctx.strokeRect(podX, podY, 4.2 * t.scale, 3.4 * t.scale);
}
}
}
// Zone Label
ctx.fillStyle = '#f8fafc';
ctx.font = '700 9px "JetBrains Mono", monospace';
ctx.fillText(z.shortLabel, zx + 5, zy + 12);
ctx.restore();
});
// 5. Layer: Sub-Surface Civil Utilities (10 Gbps Fiber Ring, OT VLAN, Stormwater Bioswale, 480V Bus)
if (state.layers.utilities) {
ctx.save();
// 10 Gbps Fiber & 10.27.0.0/16 OT VLAN Trunk
ctx.strokeStyle = '#00f0ff';
ctx.lineWidth = 1.8;
ctx.setLineDash([6, 3]);
ctx.strokeRect(t.ox + 4 * t.scale, t.oy + 4 * t.scale, 112 * t.scale, 72 * t.scale);
// Stormwater Bioswale & Permeable French Drain along South-East
ctx.strokeStyle = '#38bdf8';
ctx.lineWidth = 2.2;
ctx.setLineDash([2, 3]);
ctx.beginPath();
ctx.moveTo(t.ox + 6 * t.scale, t.oy + 75 * t.scale);
ctx.lineTo(t.ox + 114 * t.scale, t.oy + 75 * t.scale);
ctx.stroke();
ctx.setLineDash([]);
ctx.fillStyle = '#38bdf8';
ctx.font = '8px "JetBrains Mono", monospace';
ctx.fillText('STORMWATER BIOSWALE & PERMEABLE FRENCH DRAIN (Q100 RATED)', t.ox + 10 * t.scale, t.oy + 74 * t.scale);
ctx.restore();
}
// 6. Zone 6: Outer Fairway AR^OS™ Electric Go-Kart Circuit
if (state.kartSpline.length > 2) {
ctx.save();
ctx.lineCap = 'round';
ctx.lineJoin = 'round';
ctx.strokeStyle = 'rgba(30, 41, 59, 0.9)';
ctx.lineWidth = 6.2 * t.scale;
ctx.beginPath();
state.kartSpline.forEach((pt, i) => {
const sx = t.ox + pt.x * t.scale;
const sy = t.oy + pt.y * t.scale;
if (i === 0) ctx.moveTo(sx, sy);
else ctx.lineTo(sx, sy);
});
ctx.closePath();
ctx.stroke();
// AR HUD Centerline
ctx.strokeStyle = '#e879f9';
ctx.lineWidth = 1.8;
ctx.beginPath();
state.kartSpline.forEach((pt, i) => {
const sx = t.ox + pt.x * t.scale;
const sy = t.oy + pt.y * t.scale;
if (i === 0) ctx.moveTo(sx, sy);
else ctx.lineTo(sx, sy);
});
ctx.closePath();
ctx.stroke();
// Draggable Kart Control Nodes
state.kartNodes.forEach((node, idx) => {
const nx = t.ox + node.x * t.scale;
const ny = t.oy + node.y * t.scale;
const isSel = state.selectedEntity.kind === 'KART_NODE' && state.selectedEntity.idx === idx;
ctx.fillStyle = isSel ? '#f59e0b' : '#0f172a';
ctx.strokeStyle = isSel ? '#ffffff' : '#e879f9';
ctx.lineWidth = 2;
ctx.beginPath();
ctx.arc(nx, ny, isSel ? 6.5 : 5, 0, Math.PI * 2);
ctx.fill();
ctx.stroke();
});
ctx.restore();
}
// 7. Layer: Retractable Pneumatic ETFE Canopy & Safety Envelopes
if (state.layers.safety) {
ctx.save();
ctx.strokeStyle = 'rgba(16, 185, 129, 0.55)';
ctx.setLineDash([8, 4]);
ctx.lineWidth = 1.5;
ctx.strokeRect(t.ox + 4 * t.scale, t.oy + 25 * t.scale, 72 * t.scale, 49 * t.scale);
ctx.setLineDash([]);
ctx.fillStyle = '#10b981';
ctx.font = '700 8px "JetBrains Mono", monospace';
ctx.fillText('RETRACTABLE PNEUMATIC ETFE CANOPY ENVELOPE (z = +9.5m CLEAR)', t.ox + 6 * t.scale, t.oy + 24 * t.scale);
ctx.restore();
}
// 8. User-Placed Custom Modules
state.customModules.forEach(mod => {
const mx = t.ox + (mod.x - mod.w / 2) * t.scale;
const my = t.oy + (mod.y - mod.h / 2) * t.scale;
const mw = mod.w * t.scale;
const mh = mod.h * t.scale;
const isSel = state.selectedEntity.kind === 'CUSTOM' && state.selectedEntity.uid === mod.uid;
ctx.save();
ctx.fillStyle = mod.color + '44';
ctx.strokeStyle = isSel ? '#ffffff' : mod.color;
ctx.lineWidth = isSel ? 2.4 : 1.6;
ctx.fillRect(mx, my, mw, mh);
ctx.strokeRect(mx, my, mw, mh);
ctx.fillStyle = '#ffffff';
ctx.font = '700 8px "JetBrains Mono", monospace';
ctx.fillText(mod.shortTag, mx + 3, my + 10);
ctx.restore();
});
// 9. Cross-Section Cut Line Indicator (A-A' or B-B')
ctx.save();
ctx.strokeStyle = '#f59e0b';
ctx.lineWidth = 1.6;
ctx.setLineDash([10, 4, 2, 4]);
ctx.beginPath();
if (state.sectionCut === 'AA') {
const sy = t.oy + 44 * t.scale;
ctx.moveTo(t.ox - 8, sy);
ctx.lineTo(t.ox + SITE_W * t.scale + 8, sy);
ctx.stroke();
ctx.setLineDash([]);
ctx.fillStyle = '#f59e0b';
ctx.font = '700 10px "JetBrains Mono", monospace';
ctx.fillText("A", t.ox - 16, sy + 3);
ctx.fillText("A'", t.ox + SITE_W * t.scale + 6, sy + 3);
} else {
const sx = t.ox + 48 * t.scale;
ctx.moveTo(sx, t.oy - 8);
ctx.lineTo(sx, t.oy + SITE_H * t.scale + 8);
ctx.stroke();
ctx.setLineDash([]);
ctx.fillStyle = '#f59e0b';
ctx.font = '700 10px "JetBrains Mono", monospace';
ctx.fillText("B", sx - 4, t.oy - 10);
ctx.fillText("B'", sx - 5, t.oy + SITE_H * t.scale + 16);
}
ctx.restore();
}
// =========================================================================
// CROSS-SECTION ELEVATION PROFILE RENDERER (A-A' & B-B')
// =========================================================================
function renderSectionCanvas() {
const canvas = document.getElementById('sectionCanvas');
if (!canvas) return;
const rect = canvas.getBoundingClientRect();
if (rect.width === 0 || rect.height === 0) return;
const dpr = window.devicePixelRatio || 1;
canvas.width = Math.floor(rect.width * dpr);
canvas.height = Math.floor(rect.height * dpr);
const ctx = canvas.getContext('2d');
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
const W = rect.width;
const H = rect.height;
ctx.fillStyle = '#070b14';
ctx.fillRect(0, 0, W, H);
const padL = 44;
const padR = 20;
const plotW = W - padL - padR;
const zMin = -4.5;
const zMax = 11.0;
const zToY = (z) => H - 18 - ((z - zMin) / (zMax - zMin)) * (H - 30);
// Horizontal Elevation Grid Lines (-3m, 0m Datum, +4.5m, +9.5m Canopy)
[-3, 0, 4.5, 9.5].forEach(z => {
const y = zToY(z);
ctx.strokeStyle = z === 0 ? 'rgba(0, 240, 255, 0.45)' : 'rgba(51, 65, 85, 0.45)';
ctx.lineWidth = z === 0 ? 1.2 : 0.8;
ctx.beginPath();
ctx.moveTo(padL, y);
ctx.lineTo(W - padR, y);
ctx.stroke();
ctx.fillStyle = z === 0 ? '#00f0ff' : '#64748b';
ctx.font = '9px "JetBrains Mono", monospace';
ctx.fillText(`${z >= 0 ? '+' : ''}${z.toFixed(1)}m`, 4, y + 3);
});
const datumY = zToY(0);
if (state.sectionCut === 'AA') {
// Horizontal Cut X = 0..120m
const xToPx = (x) => padL + (x / 120) * plotW;
// Grade Terrain Profile
ctx.fillStyle = 'rgba(30, 41, 59, 0.65)';
ctx.strokeStyle = '#f59e0b';
ctx.lineWidth = 2;
ctx.beginPath();
ctx.moveTo(xToPx(0), H);
ctx.lineTo(xToPx(0), datumY);
ctx.lineTo(xToPx(10), datumY);
// Sunken Bowl (-3.4m)
ctx.quadraticCurveTo(xToPx(24), zToY(-3.8), xToPx(38), datumY);
// Glass Wall & Plaza
ctx.lineTo(xToPx(86), datumY);
// Banked Kart Turn (+1.8m)
ctx.lineTo(xToPx(96), zToY(1.8));
ctx.lineTo(xToPx(108), zToY(1.8));
ctx.lineTo(xToPx(120), datumY);
ctx.lineTo(xToPx(120), H);
ctx.closePath();
ctx.fill();
ctx.stroke();
// Zone 1 Vert Lip (+4.0m)
ctx.strokeStyle = '#00f0ff';
ctx.lineWidth = 2.5;
ctx.beginPath();
ctx.moveTo(xToPx(8), zToY(4.0));
ctx.quadraticCurveTo(xToPx(10), datumY, xToPx(16), zToY(-3.4));
ctx.stroke();
ctx.fillStyle = '#00f0ff';
ctx.font = '8px "JetBrains Mono", monospace';
ctx.fillText('13ft VERT (+4.0m)', xToPx(6), zToY(4.4));
// Zone 4 Digital Graffiti Glass Wall (+4.5m)
ctx.fillStyle = 'rgba(232, 121, 249, 0.35)';
ctx.strokeStyle = '#e879f9';
ctx.fillRect(xToPx(46), zToY(4.5), 4, datumY - zToY(4.5));
ctx.strokeRect(xToPx(46), zToY(4.5), 4, datumY - zToY(4.5));
ctx.fillStyle = '#e879f9';
ctx.fillText('GRAFFITI GLASS (+4.5m)', xToPx(41), zToY(5.0));
// Zone 5 Elevated WFH Focus Pods (+3.2m)
ctx.fillStyle = 'rgba(16, 185, 129, 0.35)';
ctx.strokeStyle = '#10b981';
ctx.fillRect(xToPx(62), zToY(3.2), xToPx(84) - xToPx(62), zToY(1.4) - zToY(3.2));
ctx.strokeRect(xToPx(62), zToY(3.2), xToPx(84) - xToPx(62), zToY(1.4) - zToY(3.2));
ctx.fillStyle = '#10b981';
ctx.fillText('WFH CLT PODS (+3.2m)', xToPx(63), zToY(3.6));
// Retractable ETFE Canopy Arch (+9.5m)
ctx.strokeStyle = 'rgba(56, 189, 248, 0.75)';
ctx.setLineDash([5, 3]);
ctx.beginPath();
ctx.moveTo(xToPx(5), zToY(8.2));
ctx.quadraticCurveTo(xToPx(40), zToY(10.2), xToPx(75), zToY(8.2));
ctx.stroke();
ctx.setLineDash([]);
ctx.fillStyle = '#38bdf8';
ctx.fillText('ETFE CANOPY (+9.5m)', xToPx(28), zToY(9.8));
} else {
// Cross-Section B-B' (North Y=0 to South Y=80m)
const yToPx = (y) => padL + (y / 80) * plotW;
ctx.fillStyle = 'rgba(30, 41, 59, 0.65)';
ctx.strokeStyle = '#f59e0b';
ctx.lineWidth = 2;
ctx.beginPath();
ctx.moveTo(yToPx(0), H);
ctx.lineTo(yToPx(0), zToY(1.5)); // North Ridge
ctx.lineTo(yToPx(26), datumY);
ctx.lineTo(yToPx(74), datumY);
ctx.lineTo(yToPx(76), zToY(-0.9)); // South Stormwater Bioswale
ctx.lineTo(yToPx(80), datumY);
ctx.lineTo(yToPx(80), H);
ctx.closePath();
ctx.fill();
ctx.stroke();
// WFH Pod on North Ridge (+3.2m)
ctx.fillStyle = 'rgba(16, 185, 129, 0.35)';
ctx.strokeStyle = '#10b981';
ctx.fillRect(yToPx(8), zToY(3.2), yToPx(22) - yToPx(8), zToY(1.2) - zToY(3.2));
ctx.strokeRect(yToPx(8), zToY(3.2), yToPx(22) - yToPx(8), zToY(1.2) - zToY(3.2));
ctx.fillStyle = '#10b981';
ctx.font = '8px "JetBrains Mono", monospace';
ctx.fillText('NORTH WFH PODS (+3.2m)', yToPx(7), zToY(3.7));
// Graffiti Glass Airlock (+4.5m)
ctx.fillStyle = 'rgba(232, 121, 249, 0.4)';
ctx.strokeStyle = '#e879f9';
ctx.fillRect(yToPx(32), zToY(4.5), 4, datumY - zToY(4.5));
ctx.strokeRect(yToPx(32), zToY(4.5), 4, datumY - zToY(4.5));
ctx.fillStyle = '#e879f9';
ctx.fillText('STC-52 GLASS (+4.5m)', yToPx(27), zToY(5.0));
// Street Plaza Modules (+1.4m)
ctx.fillStyle = 'rgba(56, 189, 248, 0.35)';
ctx.strokeStyle = '#38bdf8';
ctx.fillRect(yToPx(50), zToY(1.4), yToPx(68) - yToPx(50), datumY - zToY(1.4));
ctx.strokeRect(yToPx(50), zToY(1.4), yToPx(68) - yToPx(50), datumY - zToY(1.4));
ctx.fillStyle = '#38bdf8';
ctx.fillText('STREET PLAZA (+1.4m)', yToPx(50), zToY(1.9));
}
}
function renderAll() {
renderPlanCanvas();
renderSectionCanvas();
}
// =========================================================================
// INTERACTIONS: MODULE PLACEMENT, SPLINE DRAGGING & JSON CAD EXPORT
// =========================================================================
function selectTool(toolId) {
state.activeTool = toolId;
document.querySelectorAll('.tool-btn').forEach(btn => {
btn.className = 'tool-btn flex items-center justify-between px-2.5 py-1.5 rounded-xl bg-slate-900 hover:bg-slate-800 text-slate-200 border border-slate-800';
});
const activeBtn = document.getElementById(`tool-${toolId}`);
if (activeBtn) {
activeBtn.className = 'tool-btn flex items-center justify-between px-2.5 py-2 rounded-xl bg-cyan-500/20 text-cyan-200 border border-cyan-400 font-semibold';
}
const labels = {
SELECT: 'MODE: INSPECT / DRAG KART SPLINE',
WFH_POD: 'CLICK MAP TO PLACE CLT WFH FOCUS POD (14m²)',
SKATE_QP: 'CLICK MAP TO PLACE VERT QUARTER-PIPE (R=3.2m)',
LINKING_SPAN: 'CLICK MAP TO PLACE LINKINGLOGS GLULAM BRIDGE',
GRAFFITI_BAY: 'CLICK MAP TO PLACE MICROLED GRAFFITI GLASS BAY',
ACOUSTIC_BERM: 'CLICK MAP TO PLACE EARTHWORK ACOUSTIC BERM',
BIOSWALE: 'CLICK MAP TO PLACE STORMWATER BIOSWALE BASIN'
};
document.getElementById('activeToolBanner').textContent = labels[toolId] || '';
}
function setSectionCut(cut) {
state.sectionCut = cut;
const bAA = document.getElementById('btnSectionAA');
const bBB = document.getElementById('btnSectionBB');
if (cut === 'AA') {
bAA.className = 'px-2.5 py-1 rounded-lg bg-cyan-400 text-slate-950 font-bold transition';
bBB.className = 'px-2.5 py-1 rounded-lg text-slate-300 hover:text-white transition';
document.getElementById('sectionTitleLabel').textContent =
"CROSS-SECTION A–A' (Y = 44.0m): SUNKEN VERT BOWL (-3.4m) → MICROLED GLASS (+4.5m) → WFH PODS (+3.2m)";
} else {
bBB.className = 'px-2.5 py-1 rounded-lg bg-cyan-400 text-slate-950 font-bold transition';
bAA.className = 'px-2.5 py-1 rounded-lg text-slate-300 hover:text-white transition';
document.getElementById('sectionTitleLabel').textContent =
"CROSS-SECTION B–B' (X = 48.0m): NORTH WFH PODS (+3.2m) → STC-52 GLASS (+4.5m) → STREET PLAZA → BIOSWALE (-0.9m)";
}
renderAll();
}
function placeModuleAt(x, y) {
const uid = 'MOD-' + Math.floor(1000 + Math.random() * 9000);
const templates = {
WFH_POD: {
label: `CLT WFH Focus Pod (${uid})`,
shortTag: 'WFH POD',
w: 4.5, h: 3.5, zElev: 2.4, color: '#10b981',
cutM3: 4, fillM3: 12, concreteM3: 4.5,
specs: { 'Floor Area': '14.0 m²', 'Pier Elevation': '+2.40 m', 'Acoustic Rating': '≤ 38 dBA Target', 'Network': '10 Gbps Fiber' }
},
SKATE_QP: {
label: `13ft Vert Quarter-Pipe (${uid})`,
shortTag: 'VERT QP',
w: 4.0, h: 3.2, zElev: 3.96, color: '#00f0ff',
cutM3: 0, fillM3: 0, concreteM3: 8.0,
specs: { 'Transition Radius': '3.20 m', 'C1 Seam Lip': '≤ 2.0 mm', 'Peak Normal Load': '2.86 G', 'Coping': '2.375" Steel' }
},
LINKING_SPAN: {
label: `LinkingLogs Glulam Bridge (${uid})`,
shortTag: 'GLULAM BRG',
w: 4.6, h: 2.2, zElev: 1.3, color: '#f59e0b',
cutM3: 0, fillM3: 0, concreteM3: 1.2,
specs: { 'Beam Spec': 'ANSI A190.1 24F-V4', 'Span Deflection': 'δ ≤ L/360', 'Safety Factor': 'FoS ≥ 2.50', 'Telemetry': 'Dual DW3000 UWB' }
},
GRAFFITI_BAY: {
label: `MicroLED Graffiti Glass Bay (${uid})`,
shortTag: 'GLASS BAY',
w: 3.2, h: 1.2, zElev: 4.5, color: '#e879f9',
cutM3: 2, fillM3: 0, concreteM3: 3.0,
specs: { 'Dimensions': '3.0m × 4.5m', 'Acoustic Rating': 'STC-52', 'Brightness': '4,500 Nits', 'Impact Standard': 'ASTM E1300' }
},
ACOUSTIC_BERM: {
label: `Earthwork Acoustic Berm (${uid})`,
shortTag: 'BERM +2m',
w: 8.0, h: 3.0, zElev: 2.0, color: '#fbbf24',
cutM3: 0, fillM3: 48, concreteM3: 0,
specs: { 'Crest Height': '+2.00 m', 'Noise Attenuation': '-2.5 dBA Insertion', 'Compaction': '95% Modified Proctor' }
},
BIOSWALE: {
label: `Stormwater Bioswale Basin (${uid})`,
shortTag: 'BIOSWALE',
w: 7.0, h: 3.0, zElev: -0.9, color: '#38bdf8',
cutM3: 42, fillM3: 0, concreteM3: 2.5,
specs: { 'Invert Depth': '-0.90 m', 'Infiltration Rate': '180 mm/hr', 'Storm Rating': '100-Year PNW Event' }
}
};
const tpl = templates[state.activeTool];
if (!tpl) return;
const mod = { uid, type: state.activeTool, x, y, ...tpl };
state.customModules.push(mod);
state.selectedEntity = { kind: 'CUSTOM', uid };
selectTool('SELECT');
recomputeEngineeringModel();
renderAll();
showToast(`Placed ${mod.label} @ (${x.toFixed(0)}m, ${y.toFixed(0)}m)`);
}
function setupCanvasEvents() {
const canvas = document.getElementById('cadPlanCanvas');
const getSiteXY = (e) => {
const rect = canvas.getBoundingClientRect();
const clientX = e.touches ? e.touches[0].clientX : e.clientX;
const clientY = e.touches ? e.touches[0].clientY : e.clientY;
const t = getPlanTransform(canvas);
const sx = (clientX - rect.left - t.ox) / t.scale;
const sy = (clientY - rect.top - t.oy) / t.scale;
return {
x: Math.max(1, Math.min(SITE_W - 1, Math.round(sx))),
y: Math.max(1, Math.min(SITE_H - 1, Math.round(sy)))
};
};
const onDown = (e) => {
const pt = getSiteXY(e);
if (state.activeTool !== 'SELECT') {
placeModuleAt(pt.x, pt.y);
return;
}
// 1. Hit-test Kart Spline Control Nodes
for (let i = 0; i < state.kartNodes.length; i++) {
const n = state.kartNodes[i];
if (Math.hypot(n.x - pt.x, n.y - pt.y) <= 3.5) {
state.draggingKartNodeIdx = i;
state.selectedEntity = { kind: 'KART_NODE', idx: i };
refreshInspectorPanel();
renderAll();
return;
}
}
// 2. Hit-test Custom Placed Modules
for (let i = state.customModules.length - 1; i >= 0; i--) {
const m = state.customModules[i];
if (Math.abs(pt.x - m.x) <= m.w / 2 + 1 && Math.abs(pt.y - m.y) <= m.h / 2 + 1) {
state.selectedEntity = { kind: 'CUSTOM', uid: m.uid };
refreshInspectorPanel();
renderAll();
return;
}
}
// 3. Hit-test Base Zones
for (let i = 0; i < state.baseZones.length; i++) {
const z = state.baseZones[i];
if (pt.x >= z.x && pt.x <= z.x + z.w && pt.y >= z.y && pt.y <= z.y + z.h) {
state.selectedEntity = { kind: 'ZONE', id: z.id };
refreshInspectorPanel();
renderAll();
return;
}
}
};
const onMove = (e) => {
const pt = getSiteXY(e);
state.hoverPos = pt;
// Estimate local Z elevation under cursor
let zEst = 0.0;
if (Math.hypot(pt.x - 25, pt.y - 60) < 14) zEst = -3.4;
else if (pt.y < 24) zEst = 2.4;
document.getElementById('cursorCoordReadout').textContent =
`X: ${String(pt.x).padStart(3, '0')}.0m | Y: ${String(pt.y).padStart(3, '0')}.0m | Z: ${zEst >= 0 ? '+' : ''}${zEst.toFixed(2)}m`;
if (state.draggingKartNodeIdx !== -1) {
e.preventDefault();
state.kartNodes[state.draggingKartNodeIdx].x = pt.x;
state.kartNodes[state.draggingKartNodeIdx].y = pt.y;
recomputeEngineeringModel();
renderAll();
}
};
const onUp = () => {
state.draggingKartNodeIdx = -1;
};
canvas.addEventListener('mousedown', onDown);
canvas.addEventListener('mousemove', onMove);
window.addEventListener('mouseup', onUp);
canvas.addEventListener('touchstart', onDown, { passive: false });
canvas.addEventListener('touchmove', onMove, { passive: false });
window.addEventListener('touchend', onUp);
window.addEventListener('keydown', (e) => {
if (e.key === 'Escape') selectTool('SELECT');
});
}
function exportCivilManifest() {
const payload = {
_license: "Copyright © Albert Lane. All Rights Reserved. Albert Lane Proprietary Software License. https://albertlane.net",
project: {
title: "ALDI™ & AR^OS™ Suburban WFH Corporate Park HQ",
address: "1 Other Hacker Sucks Ln",
parcel_dimensions_m: { width_x: SITE_W, depth_y: SITE_H, area_sq_m: SITE_W * SITE_H },
datum: "NAVD88 (Z = 0.00m)",
ot_vlan: "10.27.0.0/16"
},
civil_earthwork_summary: {
total_cut_m3: state.metrics.cutVol,
total_fill_m3: state.metrics.fillVol,
net_earthwork_m3: state.metrics.fillVol - state.metrics.cutVol,
total_concrete_and_shotcrete_m3: state.metrics.concreteVol,
permit_validation_passed: state.metrics.errors.length === 0,
active_violations: state.metrics.errors
},
primary_zones: state.baseZones,
custom_placed_modules: state.customModules,
aros_kart_circuit: {
centerline_length_m: Number(state.metrics.totalKartLen.toFixed(2)),
min_osculating_radius_m: Number(state.metrics.minKartRadius.toFixed(2)),
control_nodes: state.kartNodes
}
};
const blob = new Blob([JSON.stringify(payload, null, 2)], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'aldi_aros_1_other_hacker_sucks_ln_civil_cad.json';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
showToast('Exported Civil CAD & Earthwork Manifest (.json)');
}
function resetMasterplan() {
initDefaultSite();
renderAll();
showToast('Masterplan reset to baseline 2027 engineering spec.');
}
function showToast(msg) {
const el = document.getElementById('toastBanner');
el.textContent = msg;
el.classList.remove('hidden');
clearTimeout(el._timer);
el._timer = setTimeout(() => el.classList.add('hidden'), 3200);
}
window.onload = () => {
initDefaultSite();
setupCanvasEvents();
renderAll();
window.addEventListener('resize', renderAll);
};
</script>
</body>
</html>