feat: one California becomes a board you can descend into
Three changes, and the first is the one that mattered. `orbitMinDistance` was `boardSpan * 0.02`. On the Bay Area that is 20.1 units of 94.3 m — 1.89 km, the range every close photograph of this product was taken at. On the merged board the same rule is 11.1 units of 1,919 m, which is 21.3 km: eleven times further out, on the one board that carries both metros' districts, landmarks and bridges. The floor is a fraction of board *size*, and board size is exactly what `unify.ts` changed without changing what stands on it — so the merged board could never resolve a city no matter what the level of detail did, because the camera was not allowed to arrive. A board that carries `detail` districts now floors on true metres instead. Boards without them keep the span rule, which is right for an atlas. The metro chapters come back. They were merged, photographed and reverted at `64618cb`, and the recorded reason was specific and true: the corridor's 4.7 km atlas glyph filled every close frame. `23e4bb8` — the next commit — added `overviewLayers`, which withdraws that glyph inside `DETAIL_STANDOFF_M`, naming that same photograph. The blocker was gone and nobody came back for the rungs it had blocked. Each rung is restated in this board's units: `distance` on `latScale` alone, `height` carrying the exaggeration ratio as well, or the camera arrives at the right altitude over relief drawn 2.6x taller and every authored angle flattens. And with `?one=1` there is one entry in `CITIES`. That is what makes the merge a board rather than a nicer tier on a three-board product: every ladder rung's `board` is `california`, so `goToPlace` never switches; the two doors stop intercepting clicks and fly their authored poses; and `DEFAULT_CITY_ID` is the one board that exists. Without the flag nothing moves, which keeps the capture guards and every budget cell aiming at the boards they were written against. Measured, all twelve budget cells PASS. `california-one` reads 355,859 triangles and 415 draws against 400,000 / 460 — unchanged from the 352,927 / 420 recorded when the board landed. No cap was raised. What this does NOT fix, photographed rather than assumed: at FiDi's 7.7 km the camera is inside the terrain, and at the Bay's 45 km the ground is visibly faceted. Both are one cause — `verticalExaggeration` is a per-board constant, correctly derived at 15x for framing the whole state, and a board you can traverse from 1,551 km to 7.7 km cannot hold it constant. See TODO.md.
This commit is contained in:
+90
-9
@@ -18,6 +18,7 @@ import {
|
||||
unifiedCalifornia,
|
||||
} from "../cities/unify.ts";
|
||||
import CALIFORNIA from "../cities/california.ts";
|
||||
import { reconciledCity } from "../cities/reconcile.ts";
|
||||
import SAN_FRANCISCO from "../cities/sf.ts";
|
||||
import SOCAL from "../cities/socal.ts";
|
||||
|
||||
@@ -129,19 +130,99 @@ describe("one California", () => {
|
||||
});
|
||||
|
||||
describe("one California's chapters", () => {
|
||||
it("is the state's list, until the corridor is drawn at true width", () => {
|
||||
/*
|
||||
* The metro rungs were merged, photographed and reverted; `unify.ts` records
|
||||
* why in full. The short version is that the conversion was right and the
|
||||
* frame was not — a two-unit stand-off on a 551-unit board lands inside the
|
||||
* corridor's 4.7 km-wide atlas glyph. This test exists so that the day
|
||||
* somebody merges them again, they do it deliberately.
|
||||
*/
|
||||
/*
|
||||
* The metro rungs were merged, photographed and reverted at `64618cb`, and
|
||||
* this test used to assert the revert so that whoever merged them again did it
|
||||
* deliberately. This is that deliberate merge, and the reason is in `unify.ts`
|
||||
* in full: the revert's stated blocker was the corridor's 4.7 km atlas glyph
|
||||
* filling every close frame, and `23e4bb8` — the next commit — withdraws that
|
||||
* glyph inside `DETAIL_STANDOFF_M`. The guard is kept and turned around: it
|
||||
* now asserts the conversion, which is the part a careless edit breaks
|
||||
* silently.
|
||||
*/
|
||||
it("carries the state's rungs first, in their authored order", () => {
|
||||
// `createScene` opens on `chapters[0]` and the capture harness reaches the
|
||||
// state's chapters by index, so the state's list has to stay a prefix.
|
||||
assert.deepEqual(
|
||||
city.chapters.map((c) => c.id),
|
||||
city.chapters.slice(0, CALIFORNIA.chapters.length).map((c) => c.id),
|
||||
CALIFORNIA.chapters.map((c) => c.id),
|
||||
);
|
||||
});
|
||||
|
||||
it("adds both metros' rungs, without their whole-board duplicates", () => {
|
||||
const ids = city.chapters.map((c) => c.id);
|
||||
for (const metro of [SAN_FRANCISCO, SOCAL]) {
|
||||
for (const chapter of metro.chapters) {
|
||||
if (chapter.id === "all") {
|
||||
// `california-overview` already frames the whole board; a second rung
|
||||
// at the same range is a repeated step on the ladder.
|
||||
assert.ok(!ids.includes(chapter.id), `whole-board rung "${chapter.id}" was merged`);
|
||||
continue;
|
||||
}
|
||||
assert.ok(ids.includes(chapter.id), `metro rung "${chapter.id}" is missing`);
|
||||
}
|
||||
}
|
||||
// Nothing merged twice, which a naive concat of two packs sharing an id
|
||||
// would do without failing anything else.
|
||||
assert.equal(new Set(ids).size, ids.length);
|
||||
});
|
||||
|
||||
it("restates each merged rung in this board's units, keeping its true metres", () => {
|
||||
/*
|
||||
* `distance` is horizontal and converts on `latScale` alone. `height` is
|
||||
* vertical, has already been through the source pack's exaggeration, and
|
||||
* has to carry the ratio of exaggerations as well — otherwise the camera
|
||||
* arrives at the right altitude over relief drawn 4.2x taller and every
|
||||
* authored angle flattens. Both are checked against the arithmetic rather
|
||||
* than against a recorded number, so a pack edit cannot falsify them.
|
||||
*/
|
||||
/*
|
||||
* Reconciled on both sides, because `unifiedCalifornia` merges reconciled
|
||||
* packs and `reconciledCity` is **not** the identity: the relief rule
|
||||
* rewrites `verticalExaggeration`, which takes San Francisco from the 3.6
|
||||
* its file authors to 5.78. Checking the arithmetic against the raw packs
|
||||
* measures a board nobody is looking at — and it fails, which is the only
|
||||
* reason this is written down rather than assumed.
|
||||
*/
|
||||
const here = reconciledCity(CALIFORNIA);
|
||||
for (const raw of [SAN_FRANCISCO, SOCAL]) {
|
||||
const metro = reconciledCity(raw);
|
||||
const horizontal = here.latScale / metro.latScale;
|
||||
const vertical =
|
||||
horizontal * (here.verticalExaggeration / metro.verticalExaggeration);
|
||||
for (const source of metro.chapters) {
|
||||
if (source.id === "all") continue;
|
||||
const merged = city.chapters.find((c) => c.id === source.id);
|
||||
assert.ok(merged, `metro rung "${source.id}" is missing`);
|
||||
// The place itself is absolute and must not have moved at all.
|
||||
assert.equal(merged.focus.lat, source.focus.lat);
|
||||
assert.equal(merged.focus.lng, source.focus.lng);
|
||||
assert.ok(
|
||||
Math.abs(merged.focus.distance - source.focus.distance * horizontal) < 1e-9,
|
||||
`"${source.id}" stand-off was not restated in this board's units`,
|
||||
);
|
||||
assert.ok(
|
||||
Math.abs(merged.focus.height - source.focus.height * vertical) < 1e-9,
|
||||
`"${source.id}" height ignored the exaggeration ratio`,
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("puts every merged rung inside the board it now belongs to", () => {
|
||||
// A rung whose focus is off the bounds is a camera aimed at empty sea, and
|
||||
// the merge is the one operation that can produce one.
|
||||
for (const chapter of city.chapters) {
|
||||
assert.ok(
|
||||
chapter.focus.lat >= city.bounds.minLat && chapter.focus.lat <= city.bounds.maxLat,
|
||||
`chapter "${chapter.id}" points off the board in latitude`,
|
||||
);
|
||||
assert.ok(
|
||||
chapter.focus.lng >= city.bounds.minLng && chapter.focus.lng <= city.bounds.maxLng,
|
||||
`chapter "${chapter.id}" points off the board in longitude`,
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("one California's cities are lotted like cities", () => {
|
||||
|
||||
Reference in New Issue
Block a user