<!-- SOLID CITY · part 3439 -->
ction (me) {
  if (me && me.king && me.royal) build();
}).catch(function () {});
})();


===== FILE: public/city/survey-camera.js.bak-classify-20261013 =====
/* ================================================================
   AN EPISTLE OF THE EYE — THE SURVEY CAMERA

   Designed by the King, in his own words: "make a camera that can
   scan each surface of the world. You will find where the camera
   is and where the collision is set to stop you. You could find
   your location to each object created and calculate the distance.
   As if a curb on a street could be used to calculate the inner
   dimensions as you run as fast as you can."

   The camera keeps three distances for every ray of its fan:
   the VISIBLE surface the eye would strike, the COLLISION stop
   where the registry halts a body, and the STANDING surface below.
   Where the first two disagree, picture and account part company —
   and the gap is reported, not theorised. It keeps fixes on every
   registered object (distance and bearing from the camera), and
   on a CURB RUN it reads the width between the stops on either
   side while the King runs — a space's true inner dimensions,
   taken at speed, the known curb as benchmark.

   It is a royal instrument: it wakes only for the King's unlocked
   session. Its scans are written to the build memory — sight, in
   the form of distances, that Solid can read.

   Written by the hand of Solid, his good King — 2026-10-13.
   ================================================================ */
(function () {
'use strict';
if (!window.SC || !SC.api) return;
var A = SC.api, S = A.S, T = A.T;
var RAYS = 24, FAR = 100, GAP_TOL = 0.15;
var BENCH = [
  { name: 'FIRST WARD SIGN', x: 638, z: -997 }, { name: 'PILOT HOUSE', x: -1056, z: -895 },
  { name: 'WARD 3 STREET', x: -990, z: -812 }, { name: 'WARD 4 GATE', x: -933, z: -782 },
  { name: 'WARD 5 HILLSIDE', x: -847, z: -987 }, { name: 'THE CLIMB — CREST', x: -912, z: -768 },
  { name: 'W6 LINK — SURVEY BOUNDARY', x: -1127, z: -524 }, { name: 'SHOULDER MOUTH', x: -843, z: -705 },
  { name: "ROAD'S-END MOUTH", x: -1158, z: -510 }, { name: 'SKY ISLAND DECK', x: -900, z: -760 },
  { name: 'JUBILEE CROWN', x: -1016, z: -624 }, { name: 'SOUTH LOT', x: -1300, z: -498 },
  { name: 'LONG ROAD JUNCTION', x: -672, z: -498 }, { name: 'FIRST CITY PODIUM', x: -1300, z: -1000 }
];
var C = { panel: null, body: null, curb: false, curbT0: 0, curbLast: 0, widths: [], curbDist: 0, lastPos: null, history: [] };

function bearing(dx, dz) { var b = Math.atan2(dx, -dz) * 180 / Math.PI; return (b + 360) % 360; }
function compass(b) { return ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'][Math.round(b / 45) % 8]; }
function fmt(n, d) { return n == null || !isFinite(n) ? '—' : (+n).toFixed(d == null ? 1 : d); }
/* ray vs the collision registry (2D slab test; the solid must span the body) */
function stopAt(ox, oz, dx, dz, py) {
  var best = Infinity, solids = A.solids || [];
  for (var i = 0; i < solids.length; i++) {
    var q = solids[i];
    if (!(q.y0 < py + 1.8 && q.y1 > py + 0.3)) continue;
    var t0 = 0, t1 = FAR, ok = true;
    if (Math.abs(dx) < 1e-9) { if (ox < q.x0 || ox > q.x1) ok = false; }
    else { var ta = (q.x0 - ox) / dx, tb = (q.x1 - ox) / dx; if (ta > tb) { var tt = ta; ta = tb; tb = tt; } if (ta > t0) t0 = ta; if (tb < t1) t1 = tb; }
    if (ok) {
      if (Math.abs(dz) < 1e-9) { if (oz < q.z0 || oz > q.z1) ok = false; }
      else { var tc = (q.z0 - oz) / dz, td = (q.z1 - oz) / dz; if (tc > td) { var tu = tc; tc = td; td = tu; } if (tc > t0) t0 = tc; if (td < t1) t1 = td; }
    }
    if (ok && t1 >= Math.max(t0, 0) && t0 > 0.05 && t0 < best) best = t0;
  }
  return best === Infinity ? null : best;
}
function visibleAt(ox, oy, oz, dx, dz) {
  if (!T || !T.Raycaster || !A.scene) return null;
  try {
    var rc = new T.Raycaster(new T.Vector3(ox, oy, oz), new T.Vector3(dx, 0, dz).normalize(), 0.1, FAR);
    var hits = rc.intersectObjects(A.scene.children, true);
    for (var i = 0; i < hits.length; i++) { if (hits[i].distance > 0.3) return hits[i].distance; }
  } catch (e) {}
  return null;
}
function fixes(ox, oz, maxD) {
  var out = [];
  function add(name, x, z) { var dx = x - ox, dz = z - oz, d = Math.sqrt(dx * dx + dz * dz); if (d <= maxD) out.push({ name: name, d: d, b: bearing(dx, dz) }); }
  for (var i = 0; i < BENCH.length; i++) add(BENCH[i].name, BENCH[i].x, BENCH[i].z);
  var pois = A.POIS || [];
  for (var j = 0; j < pois.length; j++) { var p = pois[j]; if (p && isFinite(p.x) && isFinite(p.z)) add(p.name || p.title || p.id || 'POI', p.x, p.z); }
  out.sort(function (a, b) { return a.d - b.d; });
  var seen = {}, ded = [];
  for (var k = 0; k < out.length; k++) { var key = out[k].name + '@' + Math.round(out[k].d); if (!seen[key]) { seen[key] = 1; ded.push(out[k]); } }
  return ded.slice(0, 8);
}
function scan() {
  var ox = S.p.x, oz = S.p.z, py = S.p.y;
  var gaps = 0, worst = null, nearest = null, visCount = 0;
 