Skip to content

TrailView ground plan GP6: heights: the owner, blend, kerb offset, slope, wall and terrain rules #3113

Closed

Description

@timohueser

Rewritten to the one road model (#3096); the previous body is in this issue's edit history.

Status: approved
Part of #3096. One pull request into ground-plan.
Depends on: #3135 (GP3R: the records, find, the border-safe tie rule). The fixture runs with heights.legs = wall need the leg split (GP3 follow-up, #3132); the unit tests of wall on synthetic records do not. GP6 does not wait for GP4: GP4 adds the kerb to height_at later.

TL;DR

Goal: Every point near ways and water gets one height from one function of its cell's records. Rust gives the heights of GP7's mesh vertices. WGSL gives the heights of the page texels in GP8's stamp. The two agree within 2 mm. A height steps only on a face edge, and only by a named rule of the right size. Two cells give a point on their shared border the same height bits. A carriageway is flat: its second differences on a 0.25 m grid stay at or below 2 mm (p99) at each named place and over the fixture, away from junction ramps and leg cuts.

Problem: The previous body computes heights per face over a window of 86 m: rule tiers, a blend kernel over source edges, an unframed candidate in GP3's slice, an owned-region grid. Far from the eye, GP8's far stamp gave the ways a second height function. The owner rejects two road systems (decision) and adopted one source (owner decisions). The prototype round built one point function over GP3's records, which the mesh calls at vertices and the stamp calls at texels.

Decision: height_at(block, q, label, t) in host/obc-ground-plan/src/faces/heights.rs and builder/web/src/lib/trailview/terrain/heights.wgsl. It reads the bin of q in the cell's block, the label of q and the plain terrain T(q), and nothing else. Its parts: the line surface (with the mitre band), presence and agreement, the paved field (a painter in height-key order), the slope field (cones, the no-room rule, toe and crest, band fade), and named steps. The prototype's functions move into the crate as they are (plan step 1). GP6 adds what the prototype lacks: the step names with a size check, equal bits on cell borders, a C1 rule inside tight bends, and the tests. The rule values go into the block heights of plan.json.

Rejected:

  • The previous body's tiers, blend kernel over source edges, unframed candidate and 86 m window: they read whole faces, so the far range needs another function. The bins list every record within its reach, so a point function needs no window.
  • The owned-region grid in GP6: it is a question of shapes. GP7 takes it from GP3's faces.
  • A gradient from GP6 (z_grad): GP7 takes its normals from height_at (GP7 section 5).
  • The prototype's per-quad and per-segment cones (the default of question 4): they cause the v06 trench (heights/q4b/), and both options that the owner considers (R and W) replace them. Question 1.
  • Bank times the clamped distance to the segment: a neighbour quad carried past its end sample then has a ridge with a sign flip on the chord's extension (heights/round6/). The bank multiplies the signed distance to the chord's line.
  • The soft-nearest fallback inside tight bends as the final rule: it draws a star of ridges (v17 U tip, d-hairpin inner side). GP6 replaces it (Design 1).
  • Weights with an exponential tail, and caps that drop records by bin order: two cells' bins list different records, so the bits differ on a border (section 7).
  • The host fallback of the prototype (the first record whose core holds q, else the nearest): it can switch on a medial line inside one face (section 3).
  • A second height function for the far range: the far range calls the same height_at (GP8).

Systems: trailview
Contracts: none. Rule values go into data/trailview/plan.json (block heights) and into the class fields fill_max and cut_max of data/trailview/roads.json, outside CLASS_FIELDS, so the bake does not run again. No spec, no device format.
Size: L (the port of about 1,200 lines of Rust and 1,000 lines of WGSL, the rule block, the step names, the tight-bend rule, four test suites and a bench).

Facts

Evidence paths are on timosPC under /media/timo/OSM1/tmp/ground-plan/one-model/.

  • Prototype: scratch/one-model-heights (e6c2aa1) and scratch/one-model-q4 (cc72be8, with the leg split). Rust faces/heights.rs, WGSL terrain/heights.wgsl, a line-for-line port. Not for merge.
  • Signatures there: height_at(words: &[u32], q: [f64; 2], label: Option<u32>, t: f64) -> Height { h, kind, owner, wall }; height_at_sides(words, q, [label_a, label_b], t) -> [Height; 2] finds the records once, at 0.52× the time of two calls, bit-exact (heights/cost/); WGSL height_at(block, q, label, t) -> vec2f (h, kind).
  • q is in frame units (2^−34 of the Mercator square, about 1.6 mm) from the cell's origin. Lengths use the metres per unit at the point itself: the head holds the cell's zoom-16 row and no metres-per-unit word, so the reader takes the scale at the point.
  • The production layout is GP3R's (TrailView ground plan GP3R: the records of a cell (one source for near and far) #3135, PR ground-plan GP3R: the records of a cell (one source for near and far) #3137, MAGIC 0x4f425201). It deviates from the prototype's: a sample holds 14 words (position, half-width, along, glob order, z, bank, grade, the terrain at the reach on the right and on the left of the direction in frame axes, y south, the mitre direction and two health radii); a line holds 14 words, without the prototype's fill_max and cut_max; head and candidate hold 11 words each; find returns only the label. GP6 ports the prototype's functions onto this layout.
  • The prototype keeps at most SLOTS = 8 lines at a point and QUADS = 4 quads per line (the GPU port holds the same), and drops by bin order.
  • The prototype's line weight is exp(−(across − least) / leg_blend_m), never 0.
  • Fixture scans of the prototype (256 cells, 0.5 m grid; a step is a jump over 1 cm that stays down to one frame unit):
    • Default slope: 7,743 steps; 23 inside faces (12 blend, 5 own, 3 band faces with no material line, 3 slope), 7,720 on label edges. R: 5,512 steps, 51 inside. W without a leg split: 10,790 steps, 5,059 inside (heights/round5/).
    • With the leg split and R (q4w/): 7,356 steps, 834 inside. After the shapes merge to 52680bb: 13,542 steps, 1,276 inside. The cause of that rise is not traced.
    • Cell borders, 206,308 points read by both cells: 0 over 5 mm (max 0.41 mm) before the tie rule 6539705a8; 37 over 5 mm with it, each a label that differs between the two cells (shapes/owner2/INDEX.md, "Border check").
    • GPU = Rust: max 0.91 mm over 33,750 texels, kinds equal (farb/cost/INDEX.md).
    • Ripple of the carriageway, second differences on a 0.25 m grid (heights/round6/): plain carriageway (main-road-15m) p99 well under 1 mm; v17, i07 and d-hairpin about ten times the 2 mm gate along the road; valley-junction just over it. The causes at the four places: legs that blend, the fallback star, junction ramps, the cut's mitre line.
  • Cost (native, one thread, 166 cells, under load, an early prototype): 5.3 / 51 / 89 ms per cell (median, p95, max) on a vertex proxy (0.8 m grid on paved labels, 1.63 m on slope labels); 695 ns per paved call (heights/cost/). The proxy has no face vertices. No WASM figure.
  • Owner rules for heights (answers): two roads blend below 0.5 m and step from 1.0 m; the toe and the crest are rounded about 6 m wide; the step between a railway and a road is a retaining wall. Owner decision: "Roads must be almost perfectly flat"; question 4 waits for W with the legs split by the shapes. The previous body's fill_max / cut_max: 1.5 / 2.0 for roads, tracks and rails, 1.5 / 3.0 for paths.
  • Band ownership is parked; it returns with GP4's sidewalk bands (TrailView ground plan GP4: faces of sidewalks: kerbs, driveways, zebras, corners, ends and buildings #3099, TrailView ground plan GP3 follow-ups: open decisions and review items #3132). Until then the band faces with no material line keep their steps.

Design

Words of this sub-issue

  • Record, label, host: as GP3R. The host of a label is its material line (label word 2). A blend face (a junction's region) has no host.
  • Line surface Z_r(q): the own height of line r at q.
  • Core: carriageway, shoulder and verge of a line. Core outline: the core's edge, with the corner arcs of the line's fans.
  • Feather L_r: the slope reach of line r, at least feather_min_m.
  • Global key: a record's line glob order, then its sample. It is the same in every cell.
  • Named step: a height step on a face edge that a rule of section 6 asks for, of the size that the rule gives.
  • Leg: one part of a way after GP3's leg split (question 4 of the round).

Data that GP6 reads

  • GP3R: the cell block. For a point, its bin's height-segment items and disc items. find (Rust) and model_at (WGSL) give the label.
  • GP1: Terrain::height (T), the Mercator scale.
  • data/trailview/plan.json block heights; the class fields of roads.json.

Data that GP6 writes

Rust  faces::heights::height_at(block: &[u32], q: [f64; 2], label: Option<u32>, t: f64) -> Height
      faces::heights::height_at_sides(block: &[u32], q: [f64; 2], labels: [Option<u32>; 2], t: f64) -> [Height; 2]
      struct Height { h: f64, kind: Kind, owner: u32, step: Step }
      enum Kind { Terrain, Slope, Paved }
      enum Step { None, NoRoom, CutWins, RailRoad, Unrelated, StructureEnd, Kerb }
WGSL  terrain/heights.wgsl: fn height_at(block: u32, q: vec2f, label: u32, t: f32, start: u32) -> vec2f  // (h, kind)
  • owner is the host line of a paved point, the line whose cone holds a slope point, else u32::MAX.
  • step names the rule that moves this side off the other side at a face edge (section 6). It replaces the prototype's wall: bool.
  • start is ModelPoint.heights, or 0 to walk the bin's candidates first. GP6 adds ModelPoint.heights to find's result: the first word of the bin's height lists (TrailView ground plan GP3R: the records of a cell (one source for near and far) #3135, request 6). GP8's model_at gives the same.
  • In GP3R's encoders (each a layout change, so MAGIC changes): the line words fill_max and cut_max from the class fields, once the owner decides the path values (question 2); the derived words in global f64 (section 7; TrailView ground plan GP3R: the records of a cell (one source for near and far) #3135, request 1).
  • The reader of the block heights in faces/rules.rs (the prototype reads it there already).

1. The line surface

  • Each segment has a mitre quad between the chord bisectors at its two samples. In the quad, t = da / (da + db).
  • Own height: Z = the Hermite z(t) of the two samples' z and grade, plus bank(t) × the signed distance to the chord's line. Neighbour quads agree on their shared mitre line.
  • Mitre band: each quad blends with its neighbour's surface carried on past their mitre line: z = s·own + (1 − s)·neighbour, s = smoothstep((x/w + 1)/2), x the metres from the mitre line, w = 1 / (1/mitre_band_m + 2/own + 2/other), own and other the da + db of the two quads through q. So the surface is C1 across every mitre line, and w is less than half of either quad, so the two bands of a quad never meet.
  • Health: ν falls to 0 before the quad's mitre lines cross on a bend's inner side. It is the product of both sides' health, by the signed distance across, so it is continuous on the centre line. With R or W it is full only where the frame's stretch r / (r − seg) is at most health_stretch; the stretch steepens the grade, and the steepening jumps on every mitre line.
  • A line's surface weighs its healthy quads by ν · φ((across − least) / leg_reach_m), φ = 1 − smoothstep. The weight is 0 past leg_reach_m (compact support, section 7).
  • Inside tight bends (the weight that health leaves): the prototype takes a smooth mean of the segments' surfaces at their nearest points. That draws a star of ridges along the bisectors (heights/round6/sheets/v17-sharp-corners-ripple.png). GP6 replaces it by a C1 construction. Two candidates: (a) the healthy quads carried on past their crossing and blended by a partition of unity; (b) a frame from the centre line with a least radius. Order and stop rule: build (a) first and test it at v17, i07 and d-hairpin. If (a) does not meet the per-place ripple gate there in one round, stop and report to the owner with the ripple maps before building (b). The pull request states why the other candidate went.
  • Short segments in tight bends: the mitre band is at most half a segment, so radial dashes stay on d-hairpin's outer side. The tight-bend rule covers them, or GP3 keeps a least segment length in bends (a request to TrailView ground plan GP3 follow-ups: open decisions and review items #3132). The pull request reports which.
  • Core distance: the plain distance to the nearest segment, less half-width, shoulder and verge.

2. Presence and agreement

  • Presence β_r = φ(d_r / L_r), d_r the distance past r's core.
  • Agreement of records i and j: c = max(γ(|Z_i − Z_j|), rel). γ is 1 below dz_wall / 2 and 0 above dz_wall.
  • dz_wall = the lesser line's return grade × the greater line's feather / blend_steep. Two roads: 0.15 × 10 / 1.5 = 1.0 m, the owner's value. Paths: 0.3 × 3 / 1.5 = 0.6 m (a proposed deviation, Rule block).
  • rel = 1 where a fan names the two lines as its arms and q lies within the greater feather of its circle. rel = 1 also where both lines meet a third line at corners near q, within that line's feather past both (two junctions on a short link). This relation fades over the last via_fade_m before the third line's feather, where it leaves the records.
  • Legs of one way: agreement 0 between two legs of one way, except at their cut. Without it the painter blends partly agreeing legs into each other's carriageway (v17, i07: q4w/). Proposed, not built.

3. The paved field

  • The records go in height-key order: the roads.json rank, rails first.
  • The host is the label's material line over the whole face, never pruned as absent. A paved label always names its material line, and q's bin lists it, because the face lies in that line's core or bands, inside its reach. So the host is one line over the whole face and cannot switch inside it. A paved point whose bin does not list its material line is a fault (host_missing, target 0); the prototype's fallback (the first record whose core holds q, else the nearest) goes. A cone's host is its own line.
  • A blend face has no host. Every record takes part by priority, and the face relates the junction's arms (label words 2 and 4–11).
  • Weights: a greater record i rules a lesser record j by (1 − β_i · c), fully (0) inside i's core, except the host, which keeps (1 − c) there. A lesser j keeps a greater i off its ground by (1 − β_j · (1 − c)). A greater i keeps every record but the host off its ground by (1 − β_i · (1 − c)).
  • P = Σ w·Z / Σ w, summed in the global key's order.
  • So the core of the first record is exact, a guest meets the host's edge exactly, and two ways that disagree step where the host changes: on a face edge.
  • Kerb offset: GP4's sidewalk is a band record with its own surface, the carriageway edge's height plus the kerb's rise, and the kerb is a named step (Step::Kerb). GP4 adds it in Rust and WGSL. Until then, the rule kerb offset takes P.
  • Junction ramps: a blend face's curvature over the feather is about 6 · Δz / L². The ripple gate leaves junction ramps out (Verification). A feather that grows with the height difference is an option, not tested; the pull request reports the ramps' ripple.

4. The slope field

  • Per healthy quad, a fill cone and a cut cone on P: P ∓ Δ ∓ cone(s, D), D the distance past the line's core outline. The outline includes each fan's corner arc: radius r − ring between the feet, GP3's taper at the narrower foot, the exact unsigned arc distance.
  • cone() is rounded over the first round_m. A cone lets go toward ±∞ over the last fade_share of its reach, by its own distance.
  • No room: a cone that does not meet the terrain at its reach (the records' T at the reach, right and left) steepens up to the class's fill_max or cut_max. The rest, Δ, is a wall at the road edge: a fill wall downhill, a cut wall uphill.
  • Toe and crest: G = smin(cut, smax(T, fill, k), k), with k = min(toe_per_m · D, toe_max_m, toe_span_m / 2 × gap). gap is the least of |fill slope + terrain grade| and |cut slope − terrain grade|, at least toe_gap_min, from the terrain's grade outward (the plane of the two reach terrains of the sample). So the round is about toe_span_m wide whatever the gap, and exact at the road edge.
  • Band fade: within band_fade_m of the slope band's outer edge, G fades into T. So the ground is T at the band's edge, for every band shape.
  • Question 4: the rule value heights.legs selects ramp (R: one cone pair per line, the legs meet in a ramp of leg_reach_m) or wall (W: the nearer leg alone, the leg walls on a face edge; it needs GP3's leg split, TrailView ground plan GP3 follow-ups: open decisions and review items #3132, prototype faces/legs.rs on scratch/one-model-q4). The value is ramp until the leg split lands. The owner picks from GP9's near-mesh views of v17, i07 and d-hairpin, W with the split first (owner decision). Then the other path goes, and the stretch health becomes unconditional. Neither option is clean yet (R: inside steps at the leg ramps; W with the split: the cut's mitre line steps inside junction faces).

5. The result by the label's rule

terrain → T; slope → G; owner, blend, kerb offset → P.

6. Named steps

A step stands only on a face edge. height_at_sides names it from the two sides, and a name holds only if the step has its rule's size:

Step When Size (within 1 mm) Where it stands
NoRoom a slope side whose cone has a shift Δ > 0 Δ at the paved outline: a fill wall downhill, a cut wall uphill
CutWins a slope side whose G is another line's cut (owner differs from the paved side's host) the cut's G against the other side's P at the edge of the higher feature; between hairpin legs up to the upper road
RailRoad CutWins or Unrelated where one side's line is a rail line and the other's a road as CutWins or Unrelated a retaining wall (owner)
Unrelated two paved sides with different hosts that do not agree (c < 1) |Z_i − Z_j| of the two hosts on the greater core edge
StructureEnd a line end kind of a level change (bridge, tunnel, gallery) in the records the end line's z against the other side at the end line; GP12 builds the abutment and portal faces
Kerb GP4's kerb the kerb's rise the kerb edge

A step over step_m with Step::None on both sides, or with a name whose size does not match, is a fault (check unnamed_steps, target 0). The prototype names no step; this classification is new in GP6.

7. The same bits in every cell

GP7's border check M3 needs equal height bits at a border vertex in both cells. The prototype gives a small difference, not equal bits. The function gives equal bits when every input and every operation is the same in both cells:

  1. Global inputs. The function reads only q's bin, the label and T(q). The records come from global samples (GP2's curves at global parameters). A border point has the same global position in both cells; its frame units differ by the cell origin, an exact integer. GP6 names the words that each cell derives in f32 from its own origin (mitres, health radii, and any other that the border scan finds), and GP3R's encoders derive them from global values in f64 and round them once (TrailView ground plan GP3R: the records of a cell (one source for near and far) #3135, request 1; the layout change bumps MAGIC). Lengths use the scale at the point.
  2. Compact support. Every weight is 0 past a distance up to which each bin lists every record: presence, agreement, release and band fade have compact support; the quad weight is 0 past leg_reach_m (section 1). GP3R's bins list each line's quads to its reach plus leg_reach_m (part of request 1).
  3. One order. Every sum runs in the global key's order, not in the bin's item order.
  4. Caps by the global key. Where SLOTS or QUADS drop records (section 8), they keep the first by the global key, never by bin order.
  5. T(q). GP1's Terrain::height reads global samples, so it gives equal bits at a border point. GP6's border test proves it; if it fails, GP7 computes T once for a border vertex and passes it to both cells.
  6. Labels. A point on a cell line takes the same label in both cells by GP3R's border-safe tie rule (TrailView ground plan GP3R: the records of a cell (one source for near and far) #3135, request 2, in its scope). The prototype's tie rule (6539705a8: a point on a candidate's edge counts as covered) caused the border differences of Facts. GP3R's border scan is its gate, and GP6's border gate cannot pass before it.

Stop rule: if equal bits do not hold after 1 to 6, the implementer stops and reports to the owner with the places, because GP7's border rule depends on it. The fallback for the owner to choose: a border vertex takes the height of the cell with the lower key (the other cell reads that cell's block), and GP7's M3 compares within 0.1 mm.

8. Capacity

SLOTS (8 lines at a point) and QUADS (4 quads per line) bound the GPU's arrays. A point with more lines or quads drops some (by the global key, section 7) and can jump. GP6 keeps both limits equal in Rust and WGSL and counts the points that pass them (check slots_full, target 0 over the fixture). slots_full = 0 is the proof that no cap acts on the fixture. If the fixture has such points, the limits grow and the PR states the cost.

Rule block

The block heights in data/trailview/plan.json (the crate only reads it), and two class fields in roads.json. No value lives in code.

Field Unit Value Source
heights.feather_min_m m 1.0 proposed: the least feather
heights.blend_steep 1 1.5 proposed: dz_wall = return grade × feather / blend_steep gives the owner's 1.0 m for two roads
heights.leg_reach_m m 0.5 proposed: the reach of the soft nearest of a line's healthy quads, with compact support (section 7); R's leg ramp
heights.health_margin_m, health_width_m, health_stretch m, m, 1 0.25, 1.0, 1.5 proposed
heights.round_m m 0.5 proposed: the cone's foot
heights.fade_share, fade_gap_m 1, m 0.3, 1.0 proposed: the cone's release
heights.toe_per_m, toe_max_m 1, m 1.0, 5.0 proposed
heights.toe_span_m m 6.0 owner: about 6 m
heights.toe_gap_min 1 0.1 proposed
heights.via_fade_m m 1.5 proposed
heights.band_fade_m m 1.0 proposed
heights.wall_face_m, wall_min_m m 0.5, 0.1 proposed: a slope point this near the outline, under a no-room wall higher than wall_min_m, lies on the wall's face
heights.mitre_band_m m 2.0 proposed (prototype value): the greatest half-width of the mitre band
heights.legs – ramp question 4 of the round: ramp or wall
heights.step_m m 0.001 previous body: over it, two mesh vertices
heights.wall_m m 0.01 previous body: over it, a wall's look, caster and placement
class fill_max 1 1.5 roads, tracks, rails; 3.0 paths, steps roads as before; paths: proposed deviation from 1.5
class cut_max 1 2.0 roads, tracks, rails; 3.0 paths, steps as before
(derived) dz_wall m 1.0 roads; 0.6 paths roads: owner (blend below 0.5 m, a step from 1.0 m); paths 0.3 / 0.6 m: proposed deviation by the same formula

The class fields reach height_at as two line words that GP6 adds to GP3R's layout. Reason for the two path deviations: a path's reach is 3 m, so a fill of 1.5 gives walls along most mountain paths; on one path the edge steps fall to about a sixth (heights/round3/paths/). The owner decides (question 2).

The prototype's IDEAS (fan cap, toe cap) do not port. Its debug code (explain*, PROBE) stays in the debug tool or behind cfg(test).

Invariants and how each is proven

Invariant Why it holds Proof in this PR
C0 inside every face every term is continuous within one label: quads, mitre band, health, presence, agreement, release, band fade; the host is one line per face (section 3); no cap acts (slots_full 0); the painter's sum stays positive fixture step scan: inside-face count (gate below), host_missing 0, slots_full 0; unit tests on synthetic records
The first record's core is exact every later weight is 0 there unit test: a straight road on a hillside and a T junction, host core equal to Z to 1e-9 m
A guest meets the host's edge exactly β = 1 on the host's core edge for both labels; fans relate the arms unit test: T junction
A step only on a face edge, by a named rule of its size sections 3, 4 and 6 fixture scan by rule: unnamed_steps 0 with the size check; the worst three steps of each rule as pictures
Ground = T at and past the slope band's edge band fade, release unit test at the band's edge; fixture scan of slope–terrain edges
C1 across mitre lines the mitre band ripple scan (gate below)
The same bits in every cell, T(q) included section 7 (global inputs, compact support, one order, caps by key, T, labels) border scan: every border point read by both cells, bit-equal heights and T
Rust = GPU the same records and formulas, f64 against f32 model-probe in the browser tests: ≤ 2 mm, kinds equal

Interfaces with the other items

  • GP3R (TrailView ground plan GP3R: the records of a cell (one source for near and far) #3135) gives the block, find, model_at, the border-safe tie rule (request 2), and the label words that heights read (material line, rail line, arms 4–11). With GP6's pull request: the derived words in global f64 and the bins' quad reach (request 1), and ModelPoint.heights (request 6).
  • GP3 follow-ups (TrailView ground plan GP3 follow-ups: open decisions and review items #3132) give the leg split for W (prototype faces/legs.rs), and maybe a least segment length in bends (section 1).
  • GP4 adds the kerb record and Step::Kerb to height_at, in Rust and WGSL, and the kerb's height vectors to the tests. GP4 also owns band ownership; until it lands, the band faces with no material line keep their steps.
  • GP7 takes height_at_sides at every edge vertex, height_at at every other vertex and for the normals, and Height.step for the vertical face's material. It takes the owned region from GP3's faces, not from GP6.
  • GP8 takes heights.wgsl and calls it per texel after model_at, with start. GP8 measures the GPU cost of the heights in its stamp.
  • GP12 takes Step::StructureEnd and builds the faces at structure ends. GP13 keeps rails first in the height key. GP14 adds water lines as records and their profiles.
  • GP16 takes the named walls for caps and railings.

Edge cases

  • Hairpin legs 3 to 10 m apart on steep ground: the lower leg's cut wins under the upper leg's fill; CutWins up to the upper road. With W and the split, the legs' wall stands on the medial face edge.
  • A path beside a road with no junction: Unrelated on the greater core edge.
  • A railway beside a road (Engelberg, up to 2.0 m): RailRoad, a retaining wall.
  • Bridge and tunnel ends: StructureEnd; until GP12 the end line steps to the terrain.
  • Band faces with no material line (band ownership parked, GP4): their steps stay; the inside-face gate allows them and the scan lists them apart.
  • A point with no record: T.
  • Unknown terrain: T is unknown, the height is unknown; GP7 leaves those triangles out.
  • Input faults (filed on GP2 and GP18): building passages with tunnel heights, tracks off the terrain. GP6 counts ways more than 2 m off the plain terrain and does not hide them.

Plan

  1. Move heights.rs and heights.wgsl from scratch/one-model-q4 (cc72be8) into the crate and the viewer, as they are, with the prototype's line surface. Remove Q4, IDEAS, PROBE and the per-quad cones; heights.legs selects R or W. Trace open item 6 on this commit, then measure the inside-face count on it; the PR names the commit.
  2. The block heights in plan.json, the class fields in roads.json, the reader in faces/rules.rs; the line words fill_max and cut_max in GP3R's encoders.
  3. Height.step, the classification and the size check of section 6 in height_at_sides; the WGSL returns the kind only.
  4. Section 3's host rule (host_missing) and section 7: compact weights, the global order, caps by the global key, the derived words in global f64 in GP3R's encoders, ModelPoint.heights, T at border points.
  5. The tight-bend rule of section 1 (candidate (a) first, with its stop rule), then the leg agreement of section 2 (for W).
  6. The tests and the bench (Verification); the debug tool's heights command keeps --fixture-steps, --why, --ripple, --cost, --gpu-check.

Files

  • host/obc-ground-plan/src/faces/heights.rs, faces/heights_tests.rs: create.
  • host/obc-ground-plan/src/faces/rules.rs, faces/mod.rs: change: the block heights, the module.
  • host/obc-ground-plan/src/faces/records.rs (GP3R's encoders): change: the line words fill_max and cut_max, the derived words in global f64, the quad reach, ModelPoint.heights.
  • host/obc-ground-plan/tests/heights_fixture.rs: create: the fixture suite.
  • host/obc-ground-plan/benches/heights.rs (or a debug-tool --bench): create: the cost bench.
  • builder/web/src/lib/trailview/terrain/heights.wgsl: create.
  • builder/web/tests/browser/trailview/model-probe.mjs and its test: create (or change GP3R's): Rust = GPU for heights.
  • data/trailview/plan.json, data/trailview/roads.json: change: the Rule block.
  • The debug tool and its README: change: the heights command and its options.

Verification

  • Checks (obc test -p obc-ground-plan, obc exec cargo clippy -p obc-ground-plan --all-targets -- -D warnings, cargo fmt --all):
    • Unit tests on synthetic records, one per case: a straight road on a hillside (the host's core exact; continuity inside every face; the toe rounds over about toe_span_m; G = T at the band's edge); a T junction (the guest meets the host's edge exactly); two unrelated ways that cross at 2 m (a step only on a face edge, named Unrelated, of its size); a tight bend (continuity; ripple under the gate); a road on a 60° hillside (NoRoom, a cut wall of the shift); a rail line beside a road 2 m off (RailRoad); two legs of one way, with ramp and with wall; one border point read by two cells with bins that list different far records (equal bits). One test that the reader refuses a block with a missing field.
    • Fixture suite (heights_fixture, every fixture cell, 0.5 m grid, the scan of the prototype): steps inside faces, gated on the count measured on plan step 1's commit (named in the PR) that must not grow, band-face steps listed apart (question 3); unnamed_steps 0 with the size check; host_missing 0; slots_full 0; cell borders bit-equal (heights and T) at every point that both cells read, after GP3R's tie rule. It prints the steps by rule and by class, and the worst three of each rule.
    • Ripple gate (--ripple, in the fixture suite): second differences of h on a 0.25 m grid, along and across, over the carriageway labels, leaving out blend faces, points within one feather of a junction's circle (junction ramps) and points within 2 m of a leg cut. Gate: p99 ≤ 2 mm at each of v17, i07, d-hairpin, valley-junction and main-road-15m (outside the left-out zones), and over the fixture (proposed 2 mm; owner rule: roads almost perfectly flat). Reported per place with ramps included.
    • Native = GPU (model-probe.mjs in npx vitest or the trailview browser tests, one GPU user at a time with flock /tmp/trailview-gpu.lock): at least 3,000 texels at v17, i07, d-hairpin, valley-junction, main-road-15m and a town junction: max ≤ 2 mm, kinds equal.
    • In builder/web: npm run check:wgsl.
  • Measurements (in the PR):
    • CPU cost bench (a bench, not a test): one thread, release, idle machine (state the load), every fixture cell (256), the vertex proxy with face vertices over GP3's non-terrain faces: per cell median, p95 and max; ns per call by kind; height_at_sides against two calls. The same in WASM (Node 22, GP5's bridge). No GP6 gate: the cell build's gate is GP7's 2 s jump time (epic, section 15); the PR states the share of heights in it.
    • Steps by rule and class; wall metres by rule, by class, in towns and outside, by height (1 cm, 0.3, 1, 3 m).
  • Pictures (the debug tool, top-down at 2×, --places v04,v05,v06,v11,v17,i07-hairpin,d-hairpin,hp,valley-junction,mouth-stream,conn-road-into-path,conn-track-off-road,main-road-15m,conn-steep-ramp,rail-close --layers hillshade,contours,steps,ripple; before = the prototype at cc72be8, after = the PR's head; one slider page):
    • sections across both hairpin legs at v17 and i07;
    • the worst three steps of each rule;
    • the owner looks for: no wall on an open slope; a wall between hairpin legs that reaches up to the upper road; no star of ridges in tight bends; ramps with no kink, lump or saddle; slopes that meet the terrain with no step at the band's edge; no spike, shard or terrace.

Done when

  • height_at and height_at_sides run in the crate and heights.wgsl in the viewer, line for line.
  • The fixture suite, the per-place ripple gate, the border bits and the native = GPU test pass; unnamed_steps, host_missing and slots_full are 0.
  • The PR has the cost bench (native and WASM), the step and wall tables, and the slider page, and the implementer looked at each picture.
  • The tables hold every value of the block; the code holds none.

Out of scope

  • The mesh, its vertical faces, its normals, the owned region, the strip, floors and pieces: GP7.
  • The stamp pass, the far look, the record store on the GPU, the GPU cost of the heights per stamp job: GP8. Readers: GP10.
  • The records, their layout and find / model_at: GP3R. The leg split: GP3 follow-ups (TrailView ground plan GP3 follow-ups: open decisions and review items #3132).
  • Kerbs and band ownership: GP4. Structure faces: GP12. Water records: GP14.

Open items that GP6 carries

  1. A C1 rule inside tight bends (section 1).
  2. Legs: agreement 0 between legs of one way except at their cut; the cut outside junction regions; the split at the 0.5 m blend limit against the 1.0 m step limit (question 4 waits for GP9's mesh).
  3. Junction-ramp curvature (section 3).
  4. The creases at mouth-stream-top (inside the junction's blend face, along a cross-section of the main road; the owner reads it as a crease) and below the joint at conn-road-into-path-top: causes not found (shapes/owner1/ 4b, 4c).
  5. The toe crease along the fill's toe on main-road-15m-top's downhill side, and the stair line on the lower road strand of conn-track-off-road-top (shapes/owner2/crop-mr15-top-left.png, crop-ctor-track.png): not looked at.
  6. The rise of the fixture scan's steps with the shapes merge to 52680bb: trace it on plan step 1's commit before the gate count is named.
  7. The owner's reshoot notes that are heights: v17-eye ("crumpled"), d-hairpin, and the kink at x-tertiary-eye and valley-junction where it is not the paint (shapes/owner1/ 4a fixed the corner band's paint).

Questions for the owner

  1. The per-quad cones (the prototype's default) cause the v06 trench, and both options of question 4 replace them. Recommendation: port R and W only.
  2. The path values: fill_max 3.0 (before: 1.5) and the blend of paths below 0.3 m with a step from 0.6 m (one formula with the roads' 0.5 / 1.0 m). Recommendation: accept; reason above.
  3. The gate of the step scan inside faces: 0 (the epic's hard checks) or a count measured on plan step 1's commit that must not grow. Recommendation: the measured count now, with 0 as the target at GP19, because open items 1–6 and band ownership (GP4) move steps.
  4. Question 4 itself stays open until GP9's near mesh shows W with the split and R (owner decision).

What changed from the previous body, and why

  • One point function, not heights per face. The far range evaluates the same records (owner: one road model). So the tiers, the blend kernel over source edges, the unframed candidate and the frames of wedge.rs, the 86 m window, Heights::{z, z_grad, frame} and HeightStats go.
  • The owned region leaves GP6. The shapes give it (GP7).
  • The rules are the prototype's: mitre quads with the mitre band, presence by feather, the painter in height-key order with host weights and keep-off, cones with no room, toe and crest, band fade.
  • GP6 does not wait for GP4. The kerb becomes a record that GP4 adds to height_at.
  • New: step names with a size check, equal bits on cell borders (compact weights, caps by key, T in the invariant), one host per face, the tight-bend rule with a stop rule, the capacity count, the per-place ripple gate, the native = GPU test.
  • Gates: the per-cell 20 / 60 ms and per-call gates go (owner: do not hold to per-system numbers). The CPU cost is a bench, and the 2 s jump time at GP7 gates the cell build. The frame gate is GP8's and GP9's.
  • Rule values: the block holds the prototype's values, with leg_reach_m in place of the exponential's leg_blend_m; two path values deviate from the previous ones (question 2).
  • Questions of the previous body: the ditch stays out; the epic notes on tiers and the owned region no longer apply.

Deviations in the implementation (draft PR on branch claude/gp6-heights)

  1. Rule block: no wall_face_m, wall_min_m, wall_m (no GP6 reader; GP7 and GP16 add them with their readers). via_fade_m gives both relations (a fan's and a third line's), each fading over it before the feather. window_m, blend_radius_m and their check go.
  2. The rule values travel in the records after the head (MAGIC 0x4f425203), so both ports read the same words.
  3. Step sizes are bounds: a name holds where the step lies within its rule's size and step_m (NoRoom up to the wall's top or the terrain; Unrelated up to |Z_i − Z_j|). CutWins names a slope side that another line's cut or fill holds. StructureEnd holds within band_fade_m before a level end line.
  4. Records: an end at a joint or junction with an arm on another level is a level change; the bins list height segments by the reach the heights read (a taper narrowed the bands).
  5. The painter orders equal classes by the glob order of the line's first sample.
  6. The host is never kept off by a lesser record.
  7. The toe width levels at min(toe_max_m, span height) with one C1 curve (the min had a kink: a crease along the slope).
  8. No surface past a level end: rejected (inside steps on the end line's extension).
  9. Rust find stays label-only; heights.wgsl takes start (0: walk the bin).
  10. The leg agreement of section 2 waits for the leg split's cut end kind (TrailView ground plan GP3 follow-ups: open decisions and review items #3132).
  11. SLOTS is 10 (the fixture has 9 lines at one point); the cap keeps the labels' material lines.
  12. Tight bends: candidate (a) failed its round (v17 5.75, i07 5.27 mm p99). Owner decision: (b), the least-radius frame. As built: the mitres follow the centre line's direction smoothed to a least radius (a mitre turns between two vertices by at most the chord over the radius, then a mean over the radius); the positions and the outline do not change. The least radius is the half-width plus health_margin_m and health_width_m, so the whole carriageway has full health. A mitre stays within frame_tilt_deg (30, in the block in place of health_stretch) of both chords. The health has no stretch term. The frame's metres across run along the line of equal t (the bank and the health read them), and a line's leg reach counts from its nearest quad that holds q.
  13. The fixture suite gates unnamed at 11 and the inside-face steps at 34, as measured on step 10 (before the fade, on the rebaked fixture: 326 and 69); the target stays 0. The ripple gate is 2 mm at all five places.
  14. Junction regions' edges: the region fades to the faces beyond its edges (owner decision (A)), as built in steps 8 and 10. The earlier try (the arms' relation fades toward the region candidate's rings) is not built.
    • Input. The records give each blend face its real edges, with the label beyond (TrailView ground plan GP3R: the records of a cell (one source for near and far) #3135, records::blend_edges). A bin lists every edge within MARGIN_M. The function reads only the distance from q to these edges, never an end or a position along an edge: two cells agree on the distances up to MARGIN_M, not on the ends.
    • Groups and targets. At a point q of a blend face, the edges of q's bin whose blend face is q's label, up to region_fade_m, make groups by the face beyond. D_g = the least distance from q to the edges of group g.
      • A paved face with a host line m (its material line, present at q): V = the painter with host m, which is that face's height at q.
      • Another region Y: V = the painter with no host that relates the arms of both regions. Both regions fade to the same V, so their shared edge has no step. At most REGIONS (2) regions beyond weigh at a point, the nearest; the check slots_full counts points with more (0 on the fixture).
      • A slope or the terrain: V = the arms' cones as the slope has them, without their no-room walls: clamp(T, max over the arms of fill + wall, min over the arms of cut − wall), each arm's cone on its own painter at its own distance past its outline, released near its reach as in the slope. On an arm's outline this is the cone base of the arm whose cone starts there; where the region reaches past its arms' outline (a region stub, a corner), it follows their cones.
      • A paved face with no material line (a band face, until GP4 gives it one): no fade; its step stays apart.
    • Fade. s_g = smoothstep(D_g / region_fade_m), ω_g = σ_g (1 − s_g) / s_g, and h = (P + Σ ω_g V_g) / (1 + Σ ω_g). P is the region's own painter (no host, the arms related). σ = 1 for regions and for the slope or terrain. For a host line m, σ = β_m × the region's agreement with m (the greatest β_k · c(k, m) over the arms k): an arm's face takes the full fade, and a line that disagrees with every arm keeps its step on the edge (Unrelated, RailRoad). The sums run in a fixed order: the hosts by record index, the regions by distance and target, the slope group last.
    • Names. A region has no single host: a step on its edge is named if any of its arms names it (NoRoom, CutWins by a line that is no arm, Unrelated, StructureEnd).
    • Exact at the edges. On an edge of group g, D_g = 0, so ω_g is infinite where σ_g > 0, and h = V_g. At a seam, V_g is the height of the face beyond: no step. At an outer edge, h is the slope's cone base there, so a step is that cone's no-room wall or another line's cone.
    • C1 at a seam. Near an edge, ω_g is about σ / (3 x²), x = D_g / region_fade_m, so h − V_g = O(D_g²): the region meets the face beyond with its slope.
    • C0 inside the face. D_g, β, the cones and the painters are continuous in q. ω_g is 0 from D_g = region_fade_m on, and a bin lists every edge up to MARGIN_M ≥ region_fade_m, so a change of bin changes nothing. A host that leaves the records has weight 0 there (σ ∝ β_m); an arm's cone lets go before its line leaves.
    • The same bits in every cell. The inputs are the records, T and the distances up to region_fade_m. The fixture border scan: 245,760 of 245,760 points bit-equal, heights and terrain.
    • Case distinctions that remain, with their reason: by the height rule of the face beyond. A paved face with a host has its own height function, which the region meets. Two regions have no host, so both meet the painter of all their arms. A slope's height starts at its cones' base, which the region meets; its walls stay steps. A band face with no material line has no height function of its own that is continuous over the region's edge yet (its host is the first core that holds the point): it gets no fade until GP4.
    • Rule value: heights.region_fade_m = 1.5 m (proposed: the width of the fade of a fan's relation, via_fade_m), at most MARGIN_M (the reader refuses a greater value). The rule words grow by one: MAGIC 0x4f425205.
  15. The painter has no step at a greater record's core edge (step 9). A greater record i ruled a lesser record j that is not the host by (1 − β_i c)(1 − β_i (1 − c)), and fully inside i's core. At i's core edge that product is c (1 − c): a step for every partial agreement, wherever a core edge lies inside a face (slope faces where the bands taper, regions, platforms). The factor is now 1 − β_i, which is 0 at the edge as inside. For c = 0 and c = 1 it is the same as before. The host's factor (1 − β_i c) and its share (1 − c) inside the greater core do not change. Fixture: unnamed 95 → 29, inside 68 → 34.
  16. The rounds of the paved outline name the ways at their feet (step 10). The heights' core outline includes each fan's corner arc (section 4); an outline round (a fill at an inward corner of the paved outline: a tight turn, a third piece between a point's arms, two carriageways that meet with no graph point) had no lines, so the cones started at the line's core outline, inside the paved round. Its disc now holds the way whose carriageway edge runs at each foot. A round relates nothing: no graph point joins its ways. The faces do not change. Fixture: the owner–slope unnamed steps 12 → 0.

Generated by Claude Code

Activity

  1. timohueser commented on Nov 3, 2026

    @timohueser
    OwnerAuthor

    Deviation from GP1 (PR #3117), for this sub-issue: Terrain::new(key, pages) takes the cell key and keeps only the pages that Terrain::wanted(key) lists, so heights depend on the cell alone. Terrain::height is defined only inside the cell grown by its margin and answers None past level 13; handle None, do not query outside that square.

  2. timohueser commented on Nov 4, 2026

    @timohueser
    OwnerAuthor

    GP8 deviation that affects GP6 (#3102, changed after the owner's rules): the far stamp's footprint (GP8 I1) is now a round stroke, not mitre quads with END rectangles and JOIN caps.

    • A way changes the ground only within c + reach_m of a segment of its centre line (the union of the capsules), with c = half_m + shoulder_m (GP1 has no verge_m). The flat end of a structure lies inside the same capsules.
    • So the footprint in section 9 of GP6 becomes: "a way: every point within c + reach_m of a segment of its line". No mitre corner, no (c + reach_m) / cos(θ/2).
    • Chain 3 of the rule block: the greatest far-stamp footprint is HALF_MAX_M + shoulder + reach_m = 15 + 0.6 + 10 = 25.6 m, so window_m plus it plus 2 m is 86 + 25.6 + 2 = 113.6 m, not 124.2 m.
    • The unit test "the owned region at a 90° vertex with no alignment (the mitre corner owned)" becomes "the round join owned": a radius of c + reach_m about the vertex.
    • River, lake, sea and structure footprints do not change.

    Generated by Claude Code

  3. timohueser commented on Nov 4, 2026

    @timohueser
    OwnerAuthor

    Deviation from GP4 (#3099, redesigned): what GP6 gets for sidewalks

    • No way frame and no KerbProfile. GP4 builds no src/wedge.rs and writes no frame_margin_m or frame_slack_m. GP6 builds any frame it needs from GP3's samples. GP4 writes no KerbProfile, Taper, Drop or KerbId.
    • R and F per kerb edge. FacePlan.kerbs: Vec<KerbEdge { edge, marks: Vec<KerbMark { t, rise_m, front_m }> }>. Each Kerb edge carries marks at both ends and at every breakpoint of the rise R (taper start, fillet points) and of the step height F (lowered-kerb ramps). Values are linear between marks. At a sidewalk point, the nearest Kerb edge of its own face gives z, R, F and the distance d. The height is z + F + (R − F) · min(1, d / a) + cross-fall, where a is GP6's kerb_ramp_across_m.
    • Kerb edges by relation.
      • A sidewalk edge against a carriageway, crossing, zebra or junction face is Kerb where that face belongs to the chain's road, its junction, or another road the sidewalk runs into.
      • It is Continuous and flush at a stop mouth (path, track, steps, driveway).
      • It is Continuous with UNRELATED elsewhere (rule 6).
      • Sidewalk faces carry the nearest chain's way as material. Two sidewalk groups meet at an UNRELATED edge.
    • Shoulder behind a taper. On a sidewalk chain there is no shoulder behind the slab, so ground (verge and slope) fills behind a taper. Past a chain end the shoulder starts at the end slope (45°). A taper's tip runs tangentially into the kerb with R = 0.

    Generated by Claude Code

  4. timohueser commented on Nov 4, 2026

    @timohueser
    OwnerAuthor

    Interface change from GP8 (owner approved, see #3102):

    • Snap: the far stamp's snap runs on the new path, faded in by smoothstep(floor_range, plan_range, distance). GP9's vertex_main and piece_place pass the same snap flag, so terrain and strip vertices agree bit for bit. GP9 adds floor_range and plan_range to Surface and counts strip vertices with a snap word ≠ 0 (target 0). I6 now reads: "No vertex within floor_range moves. No strip vertex moves."
    • Corners: the far stamp gets FILLET records with GP3's corner radii and class priority in carriageway overlaps. Their cones can reach up to r (≤ 9 m) past an arm's own footprint, inside the corner's fan; GP6's owned region (I1) must cover this.
    • Paint: the across code is finer (an asinh scale) on the new path only.

    Generated by Claude Code

  5. timohueser commented on Nov 5, 2026

    @timohueser
    OwnerAuthor

    DRAFT for the owner's review: GP6 rewritten for the one road model. This comment does not change the issue body. The owner decides if it replaces sections 1 to 10 of the body.

    Prototype: branch scratch/one-model-heights @ 0c3fe87 (not for merge). Pictures and notes: /media/timo/OSM1/tmp/ground-plan/one-model/heights/ (round3/, round4/, q4b/), state in one-model/PROPOSAL-heights.md.

    What GP6 becomes

    GP6 is one point function over the records of a cell:

    Rust: faces::heights::height_at(words: &[u32], q: [f64; 2], label: Option<u32>, t: f64) -> Height { h, kind, owner, wall }
    WGSL: terrain/heights.wgsl  fn height_at(block: u32, q: vec2f, label: u32, t: f32) -> vec2f   // (h, kind)
    
    • words is the cell block of the records (GP3's candidates, lines and samples, faces::records). q is in frame units from the cell origin. label is the label of find / model_at at q. t is the plain terrain at q.
    • The function reads only the bin of q and t. It reads no other terrain point and no other cell.
    • Near: the mesh (GP7) calls it once for each side of each edge vertex, with the label of that side. Far: the stamp calls it once per texel after model_at. The two ports agree to 2 mm.
    • The height rule of the label selects the result: terrain → t; slope → the slope field; owner, blend, kerb → the paved field.

    What this removes from the approved body: the tiers (section 1), the blend kernel over source edges (section 4), the unframed candidate in GP3's slice (sections 2 and 11), the 86 m window (the bins hold every record within its reach) and the owned-region bit grid (the shapes give it: the union of the slope bands and the strip).

    The rules

    1. Owner. Each segment of a line has a mitre quad (chord bisectors). Its surface is Z = Hermite z(t) + bank(t) · across. Two neighbour quads agree on their shared mitre line. A health value falls to 0 before the mitre lines cross on the inner side of a bend. The line's surface is a soft nearest of its healthy quads (weight exp(−Δ / 0.25 m)); the rest of the weight goes to a smooth mean of the segments' surfaces. So a far leg weighs nothing, two touching legs meet in a 0.25 m ramp, and a tight bend has a smooth inside.
    2. Blend (owner answer 2). Presence β = φ(d / L): φ = 1 − smoothstep, L = feather = the line's slope reach (at least 1 m). Two records agree by γ: 1 below dz_wall / 2, 0 above dz_wall. For roads dz_wall is 1.0 m: a blend up to 0.5 m, a full step from 1.0 m, as approved. A fan relates its two arms near its circle. Two lines that meet a third line near the point relate through its feather.
    3. Painter. The records go in the height-key order (roads.json rank, rails first). A greater record rules a lesser one by 1 − β · c, and fully inside its core. Each record weighs as far as it agrees with the host (the material line of the label). So the core of the first record is exact, and two disagreeing ways step where the host changes, which is a face edge.
    4. Slope cones. Each healthy quad gives a fill cone and a cut cone on the paved field, from its distance past the core outline (with the corner arcs of the fans). The foot is round over 0.5 m. A cone lets go over the last 30 % of its reach.
    5. Toe and crest (owner answer 3). G = smin(cut, smax(T, fill, k), k). k grows from 0 at the outline at 1 m per m, up to 5 m, and falls to 0 at the band's outer edge. The round is exact at the road edge.
    6. No room. Class fields fill_max, cut_max. A cone that does not meet the terrain at its reach steepens up to the class maximum. The rest is a wall at the road edge.
    7. Walls by rule. A step stands only on a face edge, with a rule name: no room (6); another feature's cut wins; two unrelated owners disagree (the step lies on the greater core edge); a structure end (GP12); the rail–road step (owner answer 1: a retaining wall).
    8. Band fade. In the last 1 m before the slope band's outer edge, G fades into T. So the ground is the terrain at the band edge, for every band shape.
    9. Scale. All lengths use the metres per frame unit at the point itself (head word 11 holds the cell's zoom-16 row), as GP3's faces do.

    Proposed rule values (a heights block in plan.json; the owner decides): feather = reach, at least 1 m; dz_wall = lesser line's return grade × greater line's feather / blend_steep (roads 1.0 m, paths 0.6 m); blend_steep 1.5; leg ramp 0.25 m; health margin 0.25 m, width 1 m, stretch 1.5; foot round 0.5 m; release 30 % of the reach, gap 1 m; toe 1 per m up to 5 m; band fade 1 m. Class fields in roads.json: fill_max 1.5 and cut_max 2 for roads, tracks and rails; 3 and 3 for paths and steps (the body has fill_max 1.5 for paths: a path's reach is 3 m, so a fill of 1.5 gave walls along most mountain paths; 1,083 → 171 edge steps on one path).

    Invariants and their proof

    Invariant Why it holds Proof Measured (fixture, 256 cells)
    C0 inside every face every term is continuous within one label fixture scan: a step is a jump over 1 cm that stays down to one frame unit 476 steps inside faces (0.5 m grid); open, see below
    the first record's core is exact every later weight is 0 there by construction —
    a guest meets the host's edge β = 1 on the core edge for both labels scan of the gate places t-tertiary, valley junction: 0 steps
    steps only on face edges, by a rule rules 6, 7 scan: steps by the pair of sides 7,687 edge steps; largest classes: rail beside the main road 998 (max 2.0 m), path walls 968, residential 807, track 648
    the same value in every cell reads only the bin of q, t and the scale at q border scan: each border point read by both cells at the same point 206,308 points: 0 over 5 mm, max 0.63 mm
    GPU = Rust the same records and formulas, f64 against f32 GPU probe against Rust max 0.32 mm, kinds equal (3,172 texels)

    Measured numbers

    • Fixture scan (0.5 m grid): 8,163 steps, 476 inside faces, 7,687 on label edges. Question 4 at round 3: R 6,078 (511 / 5,567), W 14,440 (8,599 inside: the leg walls wait for the shapes' leg split).
    • Cell borders: the old 1,367 pairs over 5 mm came from the scan. It read two points 1.6 mm apart, and 1,366 of them lie on cliffs (terrain 23:1). Read at one point: 0 over 5 mm.
    • Cost (native, fixture scan with 4 threads under the machine's other load): 1.65 µs median per call (p95 3.1 µs). GP6's vertex proxy (0.8 m grid on paved, 1.63 m on slopes): heights per cell median 11 ms, p95 110 ms, max 263 ms. This is over the gate of 20 / 60 ms. A single-thread measure on an idle machine is open. A cheap saving: per sample, store the mitre direction and the two health radii, so a segment reads 2 samples, not about 12.

    Open items

    1. Question 4 (two legs of one way at different heights): R (a 0.25 m ramp) or W (a wall; needs the shapes to split the legs). After the decision, the per-quad and per-segment cones of the default slope go (they cause the v06 trench), and the stretch health becomes unconditional.
    2. Input faults, filed on GP2 (TrailView ground plan GP2: the way graph: curves, junctions, hosts, snapped ends, levels and crossings #3098 (comment)) and GP18 (TrailView ground plan GP18: the bake on the cross-section table, cover over untagged culverts, kinds for placement, the fixture rebake #3109 (comment)): building passages with tunnel heights (up to 80 m off), tracks off the terrain, two ways that overlap at conn-track, the b45 bridge mouth.
    3. Steps inside faces (476): at v11 and i07 the agreement gate puts a step on a core edge that is not a face edge.
    4. Shadow beads beside paths (j-tt-a): lighter, not gone. A fill whose lip faces the sun at about its elevation draws shadow beads. A smoother landing needs the grade gap from the terrain's own gradient.
    5. The crest saw-tooth at main-road-15m (default slope).
    6. Not built: kerbs (they need GP4's sidewalk records), water banks (GP14), the line end kinds at structure ends (GP12).
    7. Cost over the gate (above).

    Parts proven enough to port into production now

    • The form: one point function over the cell's records, called per side of each edge vertex (near) and per texel (far), with the ports checked against each other.
    • The owner surface from mitre quads (Hermite height, bank); 0 steps on the gate places.
    • Presence with feather = reach, the agreement γ with the approved 0.5 / 1.0 m, and the painter in height-key order with host weights.
    • The cone shape (round foot, release) and the band fade.
    • The no-room rule with the class fields fill_max and cut_max.
    • The scale at the point, and the three proofs as tests: the fixture step scan by class, the border scan at one point, the GPU probe against Rust.

    Not yet: the health and fallback (they depend on question 4), the toe width (item 4), the relation through a link (likely, tested on v11 only), W's walls.


    Generated by Claude Code

  6. timohueser commented on Nov 5, 2026

    @timohueser
    OwnerAuthor

    DRAFT for review: a new body of GP6 for the one road model. This comment does not change the issue body. It replaces the earlier draft (#3113 (comment)), which has round 4's numbers. An independent reviewer reads it before the owner does.

    Sources: the round's proposal (#3096 (comment)), its review (#3096 (comment)), the owner's decisions of 2026-11-05 (#3096 (comment)), and on timosPC /media/timo/OSM1/tmp/ground-plan/one-model/: PROPOSAL-heights.md sections 1 and 8 (port plan and port note), heights/round5/, heights/round6/, heights/cost/, q4w/. Paths of evidence below are relative to that folder.


    TrailView ground plan GP6: heights: one point function height_at over the records of a cell

    Status: draft (one road model)
    Part of #3096. One pull request into ground-plan.
    Depends on: GP3R ("the records of a cell", the sub-issue that is being filed) (the records, find, model.wgsl), #3134 (GP3 follow-ups: one band candidate per way and layer). GP6 no longer waits for GP4: GP4 adds the kerb to height_at later.

    TL;DR

    Goal: Every point near ways and water gets one height from one function of its cell's records. Rust gives the heights of GP7's mesh vertices. WGSL gives the heights of the page texels in GP8's stamp. The two agree within 2 mm. A height steps only on a face edge, and only by a named rule. Two cells give a point on their shared border the same height bits. A carriageway is flat: its second differences on a 0.25 m grid stay at or below 2 mm (p99) away from junction ramps and leg cuts.

    Problem: The approved body computes heights per face over a window of 86 m: rule tiers, a blend kernel over source edges, an unframed candidate in GP3's slice, an owned-region grid. Far from the eye, GP8's far stamp gave the ways a second height function. The owner rejects two road systems (decision) and adopted one source on 2026-11-05. The prototype round built one point function over GP3's records, which the mesh calls at vertices and the stamp calls at texels.

    Decision: height_at(block, q, label, t) in host/obc-ground-plan/src/faces/heights.rs and builder/web/src/lib/trailview/terrain/heights.wgsl. It reads the bin of q in the cell's block, the label of q and the plain terrain T(q), and nothing else. Its parts: the line surface (with round 6's mitre band), presence and agreement, the paved field (a painter in height-key order), the slope field (cones, the no-room rule, toe and crest, band fade), and named steps. The prototype's functions move into the crate as they are (port plan). GP6 adds what the prototype lacks: the step names, equal bits on cell borders, a C1 rule inside tight bends, and the tests. The rule values go into the block heights of plan.json.

    Rejected:

    • The approved body's tiers, blend kernel over source edges, unframed candidate and 86 m window: they read whole faces, so the far range needs another function. The bins list every record within its reach, so a point function needs no window.
    • The owned-region grid in GP6: it is a question of shapes. GP7 takes it from GP3's faces.
    • A gradient from GP6 (z_grad): GP7 takes its normals from height_at (GP7 section 5).
    • The prototype's per-quad and per-segment cones (the default of question 4): they cause the v06 trench (heights/q4b/), and both options that the owner considers (R and W) replace them. Question 1 below.
    • Bank times the clamped distance to the segment: a neighbour quad carried past its end sample then has a ridge with a sign flip on the chord's extension (round 6: main-road-15m p99 0.45 → 2.13 mm). The bank multiplies the signed distance to the chord's line.
    • The soft-nearest fallback inside tight bends as the final rule: it draws a star of ridges (v17 U tip, d-hairpin inner side). GP6 replaces it (Design 1).
    • A second height function for the far range: the far range calls the same height_at (GP8).

    Systems: trailview
    Contracts: none. Rule values go into data/trailview/plan.json (block heights) and into the class fields fill_max and cut_max of data/trailview/roads.json, outside CLASS_FIELDS, so the bake does not run again. No spec, no device format.
    Size: L (the port of about 1,200 lines of Rust and 1,000 lines of WGSL, the rule block, the step names, the tight-bend rule, four test suites and a bench).

    Facts

    • Prototype: scratch/one-model-heights (round 5, e6c2aa1) and scratch/one-model-q4 (round 6, cc72be8, with the leg split). Rust faces/heights.rs, WGSL terrain/heights.wgsl, a line-for-line port. Not for merge.
    • Signatures there: height_at(words: &[u32], q: [f64; 2], label: Option<u32>, t: f64) -> Height { h, kind, owner, wall }; height_at_sides(words, q, [label_a, label_b], t) -> [Height; 2] finds the records once, at 0.52× the time of two calls, bit-exact (heights/cost/); WGSL height_at(block, q, label, t) -> vec2f (h, kind).
    • q is in frame units (2^−34 of the Mercator square, about 1.6 mm) from the cell's origin. Lengths use the metres per unit at the point itself; block word 11 holds the cell's zoom-16 row.
    • A sample of the records holds 14 words: position, half-width, along, glob order, z, bank, grade, the terrain at the reach on both sides (word 8 is the right of the direction in frame axes, y south; word 9 the left), the mitre direction and two health radii. A line holds 16 words, with the class's fill_max and cut_max. GP3R fixes the layout.
    • The prototype keeps at most SLOTS = 8 lines at a point and QUADS = 4 quads per line (the GPU port holds the same).
    • Measured on the fixture (256 cells, 0.5 m grid; a step is a jump over 1 cm that stays down to one frame unit):
      • Round 5, default slope: 7,743 steps; 23 inside faces (12 blend, 5 own, 3 band faces with no material line, 3 slope), 7,720 on label edges; 12 inside steps over 0.25 m, 6 over 1 m. R: 5,512 steps, 51 inside. W without a leg split: 10,790 steps, 5,059 inside (heights/round5/).
      • With the leg split and R (q4w/): 7,356 steps, 834 inside. After the shapes merge to 52680bb (round 6): 13,542 steps, 1,276 inside. The cause of that rise is not traced.
      • Cell borders, 206,308 points read by both cells: round 5 has 0 over 5 mm (max 0.41 mm). Round 6 has 37 over 5 mm, each a label that differs between the two cells.
      • GPU = Rust: max 1.01 mm (round 5, 6,845 texels), 0.65 mm (round 6, 3,172 texels), kinds equal.
      • Ripple of the carriageway, second differences on a 0.25 m grid, round 6: main-road-15m p99 0.31 mm; v17 21.8 mm along and 8.75 mm across; i07 19.9 mm along; d-hairpin 17.2 mm along; valley-junction 2.86 mm along and 3.32 mm across (heights/round6/). The causes at the four places: legs that blend, the fallback star, junction ramps, the cut's mitre line.
    • Cost (native, one thread, 166 cells, machine load 3.3–4.5, before round 5): 5.3 / 51 / 89 ms per cell (median, p95, max) on GP6's vertex proxy (0.8 m grid on paved labels, 1.63 m on slope labels); 695 ns per paved call (heights/cost/). The proxy has no face vertices. No WASM figure. In the stamp on the GPU: +0.24 to +0.3 ms per job (median), +1.2 to +1.7 ms (p95) (heights/round5/ item 3); heights are 51 % of a B stamp job on the drive (shapes/bquality/).
    • Owner rules for heights (answers): two roads blend below 0.5 m and step from 1.0 m; the toe and the crest are rounded about 6 m wide; the step between a railway and a road is a retaining wall. Owner, 2026-11-05: "Roads must be almost perfectly flat"; question 4 waits for W with the legs split by the shapes. The approved body's fill_max / cut_max (2026-11-03): 1.5 / 2.0 for roads, tracks and rails, 1.5 / 3.0 for paths.

    Design

    Words of this sub-issue

    • Record, label, host: as GP3R. The host of a label is its material line (label word 2). A blend face (a junction's region) has no host.
    • Line surface Z_r(q): the own height of line r at q.
    • Core: carriageway, shoulder and verge of a line. Core outline: the core's edge, with the corner arcs of the line's fans.
    • Feather L_r: the slope reach of line r, at least feather_min_m.
    • Named step: a height step on a face edge that a rule of section 6 asks for.
    • Leg: one part of a way after GP3's leg split (question 4 of the round).

    Data that GP6 reads

    • GP3R: the cell block. For a point, its bin's height-segment items and disc items. find (Rust) and model_at (WGSL) give the label. model_at also gives the first word of the bin's height lists (ModelPoint.heights), so the stamp walks the bin once (GP8).
    • GP1: Terrain::height (T), the Mercator scale.
    • data/trailview/plan.json block heights; the class fields of roads.json.

    Data that GP6 writes

    Rust  faces::heights::height_at(block: &[u32], q: [f64; 2], label: Option<u32>, t: f64) -> Height
          faces::heights::height_at_sides(block: &[u32], q: [f64; 2], labels: [Option<u32>; 2], t: f64) -> [Height; 2]
          struct Height { h: f64, kind: Kind, owner: u32, step: Step }
          enum Kind { Terrain, Slope, Paved }
          enum Step { None, NoRoom, CutWins, RailRoad, Unrelated, StructureEnd, Kerb }
    WGSL  terrain/heights.wgsl: fn height_at(block: u32, q: vec2f, label: u32, t: f32, start: u32) -> vec2f  // (h, kind)
    
    • owner is the host line of a paved point, the line whose cone holds a slope point, else u32::MAX.
    • step names the rule that moves this side off the other side at a face edge (section 6). It replaces the prototype's wall: bool.
    • start is ModelPoint.heights, or 0 to walk the bin's candidates first.
    • The reader of the block heights in faces/rules.rs (the prototype reads it there already).

    1. The line surface

    • Each segment has a mitre quad between the chord bisectors at its two samples. In the quad, t = da / (da + db).
    • Own height: Z = the Hermite z(t) of the two samples' z and grade, plus bank(t) × the signed distance to the chord's line. Neighbour quads agree on their shared mitre line.
    • Mitre band (round 6): each quad blends with its neighbour's surface carried on past their mitre line: z = s·own + (1 − s)·neighbour, s = smoothstep((x/w + 1)/2), x the metres from the mitre line, w = 1 / (1/(2 m) + 2/own + 2/other), own and other the da + db of the two quads through q. So the surface is C1 across every mitre line, and w is less than half of either quad, so the two bands of a quad never meet.
    • Health: ν falls to 0 before the quad's mitre lines cross on a bend's inner side. It is the product of both sides' health, by the signed distance across, so it is continuous on the centre line. With R or W it is full only where the frame's stretch r / (r − seg) is at most health_stretch; the stretch steepens the grade, and the steepening jumps on every mitre line.
    • A line's surface weighs its healthy quads by ν · exp(−(across − least) / leg_blend_m).
    • Inside tight bends (the weight that health leaves): the prototype takes a smooth mean of the segments' surfaces at their nearest points. That draws a star of ridges along the bisectors (heights/round6/sheets/v17-sharp-corners-ripple.png). GP6 replaces it by a C1 construction. Two candidates, neither tested: (a) the healthy quads carried on past their crossing and blended by a partition of unity; (b) a frame from the centre line with a least radius. The pull request builds one, proves it by the ripple and step scans at v17, i07 and d-hairpin, and states why the other went.
    • Short segments in tight bends: the mitre band is at most half a segment, so radial dashes stay on d-hairpin's outer side. The tight-bend rule covers them, or GP3R keeps a least segment length in bends. The pull request reports which.
    • Core distance: the plain distance to the nearest segment, less half-width, shoulder and verge.

    2. Presence and agreement

    • Presence β_r = φ(d_r / L_r), φ = 1 − smoothstep, d_r the distance past r's core.
    • Agreement of records i and j: c = max(γ(|Z_i − Z_j|), rel). γ is 1 below dz_wall / 2 and 0 above dz_wall.
    • dz_wall = the lesser line's return grade × the greater line's feather / blend_steep. Two roads: 0.15 × 10 / 1.5 = 1.0 m, the owner's value. Paths: 0.3 × 3 / 1.5 = 0.6 m (a proposed deviation, Rule block).
    • rel = 1 where a fan names the two lines as its arms and q lies within the greater feather of its circle. rel = 1 also where both lines meet a third line at corners near q, within that line's feather past both (two junctions on a short link). This relation fades over the last via_fade_m before the third line's feather, where it leaves the records.
    • Legs of one way: agreement 0 between two legs of one way, except at their cut. Without it the painter blends partly agreeing legs into each other's carriageway (v17, i07: p95 about 4–5 mm, q4w/). Proposed by q4w, not built.

    3. The paved field

    • The records go in height-key order: the roads.json rank, rails first.
    • The host is the label's material line over the whole face, never pruned as absent. Else the first record whose core holds q, else the nearest. A cone's host is its own line.
    • A blend face has no host. Every record takes part by priority, and the face relates the junction's arms (label words 2 and 4–11).
    • Weights: a greater record i rules a lesser record j by (1 − β_i · c), fully (0) inside i's core, except the host, which keeps (1 − c) there. A lesser j keeps a greater i off its ground by (1 − β_j · (1 − c)). A greater i keeps every record but the host off its ground by (1 − β_i · (1 − c)).
    • P = Σ w·Z / Σ w.
    • So the core of the first record is exact, a guest meets the host's edge exactly, and two ways that disagree step where the host changes: on a face edge.
    • Kerb offset: GP4's sidewalk is a band record with its own surface, the carriageway edge's height plus the kerb's rise, and the kerb is a named step (Step::Kerb). GP4 adds it in Rust and WGSL. Until then, the rule kerb offset takes P.
    • Junction ramps: a blend face's curvature over the feather is about 6 · Δz / L² (valley-junction p99 2.9 / 3.3 mm). The ripple gate leaves junction ramps out (Verification). A feather that grows with the height difference is an option, not tested; the pull request reports the ramps' ripple.

    4. The slope field

    • Per healthy quad, a fill cone and a cut cone on P: P ∓ Δ ∓ cone(s, D), D the distance past the line's core outline. The outline includes each fan's corner arc: radius r − ring between the feet, GP3's taper at the narrower foot, the exact unsigned arc distance.
    • cone() is rounded over the first round_m. A cone lets go toward ±∞ over the last fade_share of its reach, by its own distance.
    • No room: a cone that does not meet the terrain at its reach (the records' T at the reach, sample words 8 and 9) steepens up to the class's fill_max or cut_max. The rest, Δ, is a wall at the road edge: a fill wall downhill, a cut wall uphill.
    • Toe and crest: G = smin(cut, smax(T, fill, k), k), with k = min(toe_per_m · D, toe_max_m, toe_span_m / 2 × gap). gap is the least of |fill slope + terrain grade| and |cut slope − terrain grade|, at least toe_gap_min, from the terrain's grade outward (the plane of the two reach terrains of the sample). So the round is about toe_span_m wide whatever the gap, and exact at the road edge.
    • Band fade: within band_fade_m of the slope band's outer edge, G fades into T. So the ground is T at the band's edge, for every band shape.
    • Question 4: the rule value heights.legs selects ramp (R: one cone pair per line, the legs meet in a 0.25 m ramp) or wall (W: the nearer leg alone, the leg walls on a face edge; it needs GP3's leg split, faces/legs.rs on scratch/one-model-q4). The value is ramp until GP3 splits legs. The owner picks from GP9's near-mesh views of v17, i07 and d-hairpin, W with the split first (owner). Then the other path goes, and the stretch health becomes unconditional. Neither option is clean yet (R: 51 inside steps; W with split: the cut's mitre line steps inside junction faces).

    5. The result by the label's rule

    terrain → T; slope → G; owner, blend, kerb offset → P.

    6. Named steps

    A step stands only on a face edge. height_at_sides names it from the two sides:

    Step When Where it stands
    NoRoom a slope side whose cone has a shift Δ > 0 at the paved outline: a fill wall downhill, a cut wall uphill
    CutWins a slope side whose G is another line's cut (owner differs from the paved side's host) at the edge of the higher feature; between hairpin legs up to the upper road
    RailRoad CutWins or Unrelated where one side's line is a rail line and the other's a road a retaining wall (owner)
    Unrelated two paved sides with different hosts that do not agree (c < 1) on the greater core edge
    StructureEnd a line end kind of a level change (bridge, tunnel, gallery) in the records at the end line; GP12 builds the abutment and portal faces
    Kerb GP4's kerb the kerb edge

    A step over step_m with Step::None on both sides is a fault (check unnamed_steps, target 0). The prototype names no step: none of round 5's 7,720 edge steps has a rule. This classification is new in GP6.

    7. The same bits in every cell

    • The function reads only q's bin and T(q). The bins list every record within its reach. The records come from global samples (GP2's curves at global parameters). Lengths use the scale at the point.
    • GP7's border check M3 needs equal height bits at a border vertex in both cells. The prototype gives max 0.41 mm, not equal bits. Likely causes: words that each cell derives in f32 from its own origin (mitres, health radii), and sums in the order of the bin's items. Rule: GP3R derives every such word from global values in f64 and rounds once; GP6 sums in the order of a global key of each record (its line's glob order and its sample). The border check compares bits.
    • If equal bits cannot hold, the implementer stops and reports to the owner, because GP7's border rule depends on it.
    • Labels on a cell line: the owner's tie rule (a point on an edge counts as covered) is GP3R's. Round 6's 37 border differences are labels; GP3R's agreement test owns them.

    8. Capacity

    SLOTS (8 lines at a point) and QUADS (4 quads per line) bound the GPU's arrays. A point with more lines or quads drops some and can jump. GP6 keeps both limits equal in Rust and WGSL and counts the points that pass them (check slots_full, target 0 over the fixture). If the fixture has such points, the limits grow and the PR states the GPU cost.

    Rule block

    The block heights in data/trailview/plan.json (the crate only reads it), and two class fields in roads.json. No value lives in code.

    Field Unit Value Source
    heights.feather_min_m m 1.0 proposed: the least feather
    heights.blend_steep 1 1.5 proposed: dz_wall = return grade × feather / blend_steep gives the owner's 1.0 m for two roads
    heights.leg_blend_m m 0.25 proposed: the soft nearest of a line's healthy quads; R's leg ramp
    heights.health_margin_m, health_width_m, health_stretch m, m, 1 0.25, 1.0, 1.5 proposed
    heights.round_m m 0.5 proposed: the cone's foot
    heights.fade_share, fade_gap_m 1, m 0.3, 1.0 proposed: the cone's release
    heights.toe_per_m, toe_max_m 1, m 1.0, 5.0 proposed
    heights.toe_span_m m 6.0 owner: about 6 m
    heights.toe_gap_min 1 0.1 proposed
    heights.via_fade_m m 1.5 proposed
    heights.band_fade_m m 1.0 proposed
    heights.wall_face_m, wall_min_m m 0.5, 0.1 proposed: a slope point this near the outline, under a no-room wall higher than wall_min_m, lies on the wall's face
    heights.mitre_band_m m 2.0 round 6: the greatest half-width of the mitre band
    heights.legs – ramp question 4 of the round: ramp or wall
    heights.step_m m 0.001 approved body: over it, two mesh vertices
    heights.wall_m m 0.01 approved body: over it, a wall's look, caster and placement
    class fill_max 1 1.5 roads, tracks, rails; 3.0 paths, steps roads as approved; paths: proposed deviation from the approved 1.5
    class cut_max 1 2.0 roads, tracks, rails; 3.0 paths, steps as approved
    (derived) dz_wall m 1.0 roads; 0.6 paths roads: owner (blend below 0.5 m, a step from 1.0 m); paths 0.3 / 0.6 m: proposed deviation by the same formula

    Reason for the two path deviations: a path's reach is 3 m, so a fill of 1.5 gives walls along most mountain paths; on one path the edge steps fall from 1,083 to 171 (heights/round3/paths/). The owner decides (question 2).

    The prototype's IDEAS (fan cap, toe cap) do not port. Its debug code (explain*, PROBE) stays in the debug tool or behind cfg(test).

    Invariants and how each is proven

    Invariant Why it holds Proof in this PR
    C0 inside every face every term is continuous within one label: quads, mitre band, health, presence, agreement, release, band fade; the painter's sum stays positive fixture step scan: inside-face count (gate below); unit tests on synthetic records
    The first record's core is exact every later weight is 0 there unit test: a straight road on a hillside and a T junction, host core equal to Z to 1e-9 m
    A guest meets the host's edge exactly β = 1 on the host's core edge for both labels; fans relate the arms unit test: T junction
    A step only on a face edge, by a named rule sections 3, 4 and 6 fixture scan by rule: unnamed_steps 0; the worst three steps of each rule as pictures
    Ground = T at and past the slope band's edge band fade, release unit test at the band's edge; fixture scan of slope–terrain edges
    C1 across mitre lines the mitre band ripple scan (gate below)
    The same bits in every cell section 7 border scan: every border point read by both cells, bit-equal
    Rust = GPU the same records and formulas, f64 against f32 model-probe in the browser tests: ≤ 2 mm, kinds equal

    Interfaces with the other items

    Edge cases

    • Hairpin legs 3 to 10 m apart on steep ground: the lower leg's cut wins under the upper leg's fill; CutWins up to the upper road. With W and the split, the legs' wall stands on the medial face edge.
    • A path beside a road with no junction: Unrelated on the greater core edge.
    • A railway beside a road (Engelberg, up to 2.0 m): RailRoad, a retaining wall.
    • Bridge and tunnel ends (2,046 pairs up to 4.3 m in an earlier scan): StructureEnd; until GP12 the end line steps to the terrain.
    • A point with no record: T.
    • Unknown terrain: T is unknown, the height is unknown; GP7 leaves those triangles out.
    • Input faults (filed on GP2 and GP18): building passages with tunnel heights (up to 80.5 m off), tracks off the terrain (up to 6.8 m). GP6 counts ways more than 2 m off the plain terrain and does not hide them.

    Plan

    1. Move heights.rs and heights.wgsl from scratch/one-model-q4 (cc72be8) into the crate and the viewer, as they are, with round 6's line surface. Remove Q4, IDEAS, PROBE and the per-quad cones; heights.legs selects R or W.
    2. The block heights in plan.json, the class fields in roads.json, the reader in faces/rules.rs.
    3. Height.step and the classification of section 6 in height_at_sides; the WGSL returns the kind only.
    4. Section 7: the global order of sums; with GP3R, the derived words in f64.
    5. The tight-bend rule of section 1, then the leg agreement of section 2 (for W).
    6. The tests and the bench (Verification); the debug tool's heights command keeps --fixture-steps, --why, --ripple, --cost, --gpu-check.

    Files

    • host/obc-ground-plan/src/faces/heights.rs, faces/heights_tests.rs: create.
    • host/obc-ground-plan/src/faces/rules.rs, faces/mod.rs: change: the block heights, the module.
    • host/obc-ground-plan/tests/heights_fixture.rs: create: the fixture suite.
    • host/obc-ground-plan/benches/heights.rs (or a debug-tool --bench): create: the cost bench.
    • builder/web/src/lib/trailview/terrain/heights.wgsl: create.
    • builder/web/tests/browser/trailview/model-probe.mjs and its test: create (or change GP3R's): Rust = GPU for heights.
    • data/trailview/plan.json, data/trailview/roads.json: change: the Rule block.
    • The debug tool and its README: change: the heights command and its options.

    Verification

    • Checks (obc test -p obc-ground-plan, obc exec cargo clippy -p obc-ground-plan --all-targets -- -D warnings, cargo fmt --all):
      • Unit tests on synthetic records, one per case: a straight road on a hillside (the host's core exact; continuity inside every face; the toe rounds over about toe_span_m; G = T at the band's edge); a T junction (the guest meets the host's edge exactly); two unrelated ways that cross at 2 m (a step only on a face edge, named Unrelated); a tight bend (continuity; ripple under the gate); a road on a 60° hillside (NoRoom, a cut wall of the shift); a rail line beside a road 2 m off (RailRoad); two legs of one way, with ramp and with wall. A test for each rule field: the reader refuses a table without it.
      • Fixture suite (heights_fixture, every fixture cell, 0.5 m grid, the scan of the prototype): steps inside faces, gated on a count measured on the PR's first head (named in the PR) that must not grow (question 3); unnamed_steps 0; slots_full 0; cell borders bit-equal at every point that both cells read. It prints the steps by rule and by class, and the worst three of each rule.
      • Ripple gate (--ripple, in the fixture suite): second differences of h on a 0.25 m grid, along and across, over every carriageway label of the fixture, leaving out blend faces, points within one feather of a junction's circle (junction ramps) and points within 2 m of a leg cut. Gate: p99 ≤ 2 mm (owner: roads almost perfectly flat; round 6 measured 0.31 mm on plain carriageway). Reported per place for v17, i07, d-hairpin, valley-junction and main-road-15m, ramps included.
      • Native = GPU (model-probe.mjs in npx vitest or the trailview browser tests, one GPU user at a time with flock /tmp/trailview-gpu.lock): at least 3,000 texels at v17, i07, d-hairpin, valley-junction, main-road-15m and a town junction: max ≤ 2 mm, kinds equal.
      • In builder/web: npm run check:wgsl.
    • Measurements (in the PR):
      • CPU cost bench (a bench, not a test): one thread, release, idle machine (state the load), every fixture cell (256), GP6's vertex proxy with face vertices and the level-18 grid of the owned region: per cell median, p95 and max; ns per call by kind; height_at_sides against two calls. The same in WASM (Node 22, GP5's bridge). No GP6 gate: the cell build's gate is GP7's 2 s jump time (epic, section 15); the PR states the share of heights in it.
      • GPU cost per stamp job (with GP8's stamp, flight.mjs --gpu, walk and valley-drive): the heights' share per job (median, p95) and per frame. The frame gate is GP8's and GP9's: the road share no slower than develop's, measured with GP0's alternate-frame method against the flight with no ways.
      • Steps by rule and class; wall metres by rule, by class, in towns and outside, by height (1 cm, 0.3, 1, 3 m).
    • Pictures (the debug tool, top-down at 2×, --places v04,v05,v06,v11,v17,i07-hairpin,d-hairpin,hp,valley-junction,mouth-stream,conn-road-into-path,conn-track-off-road,main-road-15m,conn-steep-ramp,rail-close --layers hillshade,contours,steps,ripple; before = the prototype at cc72be8, after = the PR's head; one slider page):
      • sections across both hairpin legs at v17 and i07;
      • the worst three steps of each rule;
      • the owner looks for: no wall on an open slope; a wall between hairpin legs that reaches up to the upper road; no star of ridges in tight bends; ramps with no kink, lump or saddle; slopes that meet the terrain with no step at the band's edge; no spike, shard or terrace.

    Done when

    • height_at and height_at_sides run in the crate and heights.wgsl in the viewer, line for line.
    • The fixture suite, the ripple gate, the border bits and the native = GPU test pass; unnamed_steps and slots_full are 0.
    • The PR has the cost bench (native and WASM), the GPU share per stamp job, the step and wall tables, and the slider page, and the implementer looked at each picture.
    • The tables hold every value of the block; the code holds none.

    Out of scope

    • The mesh, its vertical faces, the owned region, the strip, floors and pieces: GP7.
    • The stamp pass, the far look, the record store on the GPU: GP8. Readers: GP10.
    • The records, their encoders and find / model_at: GP3R. The leg split and band ownership: GP3.
    • Kerbs: GP4. Structure faces: GP12. Water records: GP14.

    Open items that GP6 carries (from the port note)

    1. A C1 rule inside tight bends (section 1).
    2. Legs: agreement 0 between legs of one way except at their cut; the cut outside junction regions; the split at the 0.5 m blend limit against the 1.0 m step limit (question 4 waits for GP9's mesh).
    3. Junction-ramp curvature (section 3).
    4. The creases at mouth-stream-top (inside the junction's blend face, along a cross-section of the main road; the owner reads it as a crease) and below the joint at conn-road-into-path-top: causes not found (shapes/owner1/ 4b, 4c).
    5. The toe crease along the fill's toe on main-road-15m-top's downhill side, and the stair line on the lower road strand of conn-track-off-road-top (shapes/owner2/crop-mr15-top-left.png, crop-ctor-track.png): not looked at.
    6. The rise of the fixture scan from 7,356 to 13,542 steps with the shapes merge to 52680bb: trace it on the PR's first head before the gate count is named.
    7. The owner's reshoot notes that are heights: v17-eye ("crumpled"), d-hairpin, and the kink at x-tertiary-eye and valley-junction where it is not the paint (shapes/owner1/ 4a fixed the corner band's paint).

    Questions for the owner

    1. The per-quad cones (the prototype's default) cause the v06 trench, and both options of question 4 replace them. Recommendation: port R and W only.
    2. The path values: fill_max 3.0 (approved 1.5) and the blend of paths below 0.3 m with a step from 0.6 m (one formula with the roads' 0.5 / 1.0 m). Recommendation: accept; reason above.
    3. The gate of the step scan inside faces: 0 (the epic's hard checks) or a count measured on a named build that must not grow. Recommendation: a measured count now, with 0 as the target at GP19, because open items 1–6 move steps.
    4. Question 4 itself stays open until GP9's near mesh shows W with the split and R (owner, 2026-11-05).

    What changed from the approved body, and why

    • One point function, not heights per face. The far range evaluates the same records (owner: one road model). So the tiers (section 1), the blend kernel over source edges (section 4), the unframed candidate and the frames of wedge.rs (sections 2 and 11), the 86 m window, Heights::{z, z_grad, frame} and HeightStats go.
    • The owned region leaves GP6. The shapes give it (GP7).
    • The rules are the prototype's (rounds 3 to 6): mitre quads with the mitre band, presence by feather, the painter in height-key order with host weights and keep-off, cones with no room, toe and crest, band fade.
    • GP6 does not wait for GP4. The kerb becomes a record that GP4 adds to height_at.
    • New: step names, equal bits on cell borders, the tight-bend rule, the capacity count, the ripple gate, the native = GPU test.
    • Gates: the per-cell 20 / 60 ms and per-call gates go (owner: do not hold to per-system numbers). The CPU cost is a bench, and the 2 s jump time at GP7 gates the cell build. The frame gate is GP8's and GP9's.
    • Rule values: the block holds the prototype's values; two path values deviate from approved ones (question 2).
    • Questions of the approved body: the ditch stays out; the epic notes on tiers and the owned region no longer apply.

    Generated by Claude Code

  7. timohueser commented on Nov 5, 2026

    @timohueser
    OwnerAuthor

    Status of GP6: draft PR #3140 (branch claude/gp6-heights, head e9ac916).

    Done:

    • height_at, height_at_sides (with Height.step) in faces::heights; heights.wgsl line for line, with records.wgsl and model-words.wgsl for the block's words. Rule values in plan.json block heights and the class fields fill_max, cut_max; the records carry them (MAGIC 0x4f425203).
    • Fixture (256 cells, 0.5 m): 74 steps inside faces (gate: 140, measured on step 1's commit bab055a); slots_full 0; host_missing 0; 245,760 of 245,760 border points bit-equal (heights and terrain).
    • GPU = Rust: 140,025 points at six places and a point with 9 lines, max 0.505 mm, kinds equal.
    • Cost, one thread: 1.1 / 27.5 / 80.9 ms per cell (median, p95, max); height_at_sides 0.59 times two calls.
    • 8 unit tests on synthetic cells and the fixture suite heights_fixture (42 s).

    Left:

    1. Owner decision: tight bends. Candidate (a) failed its one round (v17 along p99 4.28 → 5.75 mm, i07 3.57 → 5.27 mm). Past the mitre crossing every segment is unhealthy, so a partition of the quads cannot hold the surface there. Options: (b) a frame with a least radius, or a hub surface. Maps: /media/timo/OSM1/tmp/ground-plan/gp6/step5/. The ripple gate fails at v17 (4.43 mm) and i07 (3.60 mm) until then.
    2. Owner decision: junction regions' edges. 244 of the 346 unnamed steps lie on a blend face's edge (against its arms' carriageways or slopes): the blend face relates its arms, the faces beside it do not. Options: the relation fades toward the region's seams, or reaches as far as the region.
    3. The other 102 unnamed steps (slope against slope 59, owner against slope 18, owner against owner 13, others): not traced one by one.
    4. The leg agreement of section 2: waits for the leg split's cut end kind (TrailView ground plan GP3 follow-ups: open decisions and review items #3132).
    5. Not made: the WASM cost, the "before" pictures of the prototype and the slider page; I looked at 5 of the 15 places' pictures (gp6/pictures/INDEX.md).

    Deviations from this body (also in the PR):

    1. Rule block: no wall_face_m, wall_min_m, wall_m (no GP6 reader; GP7 and GP16 add them with their readers). via_fade_m gives both relations (a fan's and a third line's), each fading over it before the feather. window_m, blend_radius_m and their check go.
    2. The rule values travel in the records after the head, so both ports read the same words.
    3. Step sizes are bounds: a name holds where the step lies within its rule's size and step_m (NoRoom up to the wall's top or the terrain; Unrelated up to |Z_i − Z_j|). CutWins names a slope side that another line's cut or fill holds. StructureEnd holds within band_fade_m before a level end line.
    4. Records: an end at a joint or junction with an arm on another level is a level change; the bins list height segments by the reach that the heights read (a taper narrowed the bands, and a bin border then saw a segment in one bin only).
    5. The painter orders equal classes by the glob order of the line's first sample.
    6. The host is never kept off by a lesser record (else all weights could vanish).
    7. The toe width levels at min(toe_max_m, span height) with one C1 curve (the min had a kink: a crease along the slope).
    8. No surface past a level end: tried and rejected (inside steps on the end line's extension).
    9. Rust find stays label-only; heights.wgsl takes start (0: walk the bin).
    10. SLOTS is 10 (the fixture has 9 lines at one point); the cap keeps the labels' material lines.
    11. The fixture suite holds unnamed at 346 and the hairpins' ripple at 4.5 mm as measured; the targets stay 0 and 2 mm.

    I did not edit the body: the tool refused it. The orchestrator can move the deviations into the body.


    Generated by Claude Code

  8. timohueser commented on Nov 5, 2026

    @timohueser
    OwnerAuthor

    Status of GP6 after step 7a: draft PR #3140 (branch claude/gp6-heights, head 5954c49).

    Done in this session:

    • Owner decision 1, the least-radius frame: built, Rust and WGSL. The mitres follow the centre line's direction smoothed to a least radius (half-width + health_margin_m + health_width_m), within frame_tilt_deg (30) of both chords; positions and outline do not change. The health has no stretch term. The frame's metres across run along the line of equal t (bank and health read them); a line's leg reach counts from its nearest quad that holds q. Deviation 12 of the body says why it is not "the half-width" alone.
    • Ripple p99 along / across: v17 4.43 / 0.59 -> 1.11 / 1.54 mm, i07 3.60 / 0.44 -> 0.98 / 1.42 mm, d-hairpin 0.40 / 0.01, main-road-15m 0.31 / 0.00, valley-junction 0.35 / 0.00. The fixture suite now gates 2 mm at all five places.
    • The star at v17's U tip: the fallback's rays are gone; the contours make a clean fan about the island tip (/media/timo/OSM1/tmp/ground-plan/gp6/step7/, before and after, INDEX.md). A small fan of 0.5 to 6.7 mm stays in the ripple map at the island tip: the helicoid near its axis, read along the chords.
    • Fixture: inside 74 -> 73 (gate 140), unnamed 346, border 245,760 of 245,760 bit-equal (heights and terrain), slots_full 0, host_missing 0. GPU = Rust: 115,786 points at six places, max 0.397 mm, kinds equal.
    • Checks: obc test -p obc-ground-plan passed, clippy clean, fmt clean, check-wgsl validates. One new Rust unit test (the frame); no browser test.
    • PR body and this issue's deviation section (items 12 to 14) are current.

    Left:

    1. Owner decision 2, junction regions' edges (244 of the 346 unnamed): not built; it needs a design decision. Tried and not committed (patch in the session scratchpad only): fading the arms' relation by the distance to the region candidate's rings and seam cuts over via_fade_m gives unnamed 319, inside 128; fading the result gives unnamed 320, inside 107. Causes: (a) the blend face has no host, and its painter differs from a neighbour's host painter wherever any two records agree in part, not only the arms (46.8201441, 8.3911948: a rail 0.77 m below a road); (b) a partial relation inside the region steps at a greater record's core edge (46.8229918, 8.3971421: 1.67 m); (c) other faces cut into the region, so the candidate's ring is not the face's edge (46.7781887, 8.3854051). Options: (A) near each seam the region fades to the host painter of the face beyond it, near its outer edge to the nearest arm's cone base; needs each blend face's true edges in GP3R's records; (B) a soft host: the arms' host painters weighted by core distance.
    2. The other 102 unnamed: not traced one by one. Traced: an owner face that reaches 0.5 m past its line's core outline while the cut cone already rises 0.57 m (46.8261979, 8.4057683: cones measure from the line's core outline, not the paved face's edge); and the tight switchbacks of paths.
    3. The leg agreement of section 2 (waits for TrailView ground plan GP3 follow-ups: open decisions and review items #3132), the WASM cost, the cost bench at 7a, the "before" pictures of the prototype and the slider page.
    4. When 1 and 2 hold (unnamed 0) and item 3 is made, mark ground-plan GP6: the heights of the one road model (draft: open items for the owner) #3140 ready for review (no merge, no auto-merge).

    Tools for the next session: debug heights --fixture-steps --out DIR (classes with worst_at), --why LAT,LON, --places ... --at NAME=LAT,LON --size-m 16 for zooms, --gpu-check then model-probe.mjs under flock /tmp/trailview-gpu.lock with Node 22 on PATH. Build with obc exec env CARGO_TARGET_DIR=/media/timo/OSM1/cache/cargo-target-gp6 cargo ....


    Generated by Claude Code

  9. timohueser commented on Nov 5, 2026

    @timohueser
    OwnerAuthor

    Owner decisions (2026-11-05):

    • Tight bends: the least-radius frame is built (step 7a, 5954c49). Ripple p99 along / across: v17 1.11 / 1.54 mm, i07 0.98 / 1.42 mm. All five named places pass the 2 mm gate. The U-tip star is gone.
    • Junction regions: (A) fade to the neighbours. Near each seam, the region's height fades to the host painter of the face beyond it. Near its outer edge it fades to the nearest arm's cone base. This is exact at the edges by construction. It needs each blend face's real edges in GP3R's records (TrailView ground plan GP3R: the records of a cell (one source for near and far) #3135), and that layout change comes first. The seam fade on the region ring was tried and not kept (346 → about 320 unnamed, inside faces 73 → 107–128).

    Next for GP6:

    1. The records carry the blend faces' real edges (TrailView ground plan GP3R: the records of a cell (one source for near and far) #3135).
    2. Build (A) and prove it: unnamed steps at region edges → 0, inside faces ≤ 73.
    3. Trace the other 102 unnamed steps. The causes found so far: the cones measure from the line's core outline rather than the paved face's edge (46.8261979, 8.4057683), and tight path switchbacks.
    4. Then mark PR ground-plan GP6: the heights of the one road model (draft: open items for the owner) #3140 ready, review it, and merge it.

    Generated by Claude Code

  10. timohueser commented on Nov 5, 2026

    @timohueser
    OwnerAuthor

    Status of GP6 after steps 8 to 10: draft PR #3140 (branch claude/gp6-heights, head da175f7).

    The baseline is the merge of #3148, #3156 and ground-plan (8796d0e, the rebaked fixture of #3138). On it: 326 unnamed steps (239 at junction-region edges), 69 inside faces.

    Done:

    • Step 8 (fe48463), owner decision (A): a junction region fades near its edges to the face beyond. It reads only the distances to its real edges (records::blend_edges), up to region_fade_m (1.5 m, proposed, at most MARGIN_M). The design, the invariants and the case distinctions are in deviation 14 of the body. A region's step is named by any of its arms. Unit test: a T junction beside a rail.
    • Step 9 (081fd02): the painter has no step at a greater record's core edge (deviation 15). This was the cause of the 56 slope-against-slope steps and of half of the inside steps.
    • Step 10 (da175f7): the rounds of the paved outline name the ways at their feet, so the cones start at the round's arc (deviation 16). A region meets a slope at its arms' cone field without walls. A band face with no material line gets no fade.
    before (8796d0e) after (da175f7) target
    unnamed steps 326 11 0
    unnamed at junction-region edges 239 0 0
    steps inside faces 69 34 must not grow
    apart (band faces, platforms) 1,328 992
    border points bit-equal 245,760 / 245,760 245,760 / 245,760 all
    slots_full, host_missing 0, 0 0, 0 0
    ripple p99 along / across, mm v17 1.26 / 1.99, i07 1.07 / 1.78, d-hairpin 0.40 / 0.01, main-road-15m 0.31 / 0.00, valley-junction 0.35 / 0.00 the same ≤ 2
    GPU = Rust 213,822 points, max 0.557 mm, kinds equal ≤ 2 mm

    The ripple at v17 rose from 1.11 / 1.54 mm (step 7a) to 1.26 / 1.99 mm with the rebaked fixture, the same before and after this work: 0.01 mm under the gate.

    Cost: native A-B-B-A, per cell median ratio 1.02 (p5 0.84, p95 1.08); median 1.14 ms of heights per cell. WASM (Node 22, the bridge with a bench export that is not committed) against native on the 213,822 probe points: slope calls 1.93 times, paved calls 1.15 times as slow (about 2,500 and 1,850 ns per call at these dense places).

    Left:

    1. 11 unnamed steps, none at a junction region, each traced: a line's own surface jumps where the set of its quads changes (5, legs and tight path bends: question 4, TrailView ground plan GP3 follow-ups: open decisions and review items #3132); Unrelated larger than |Z_i − Z_j| because a third road pulls one path's painter (4); two agreeing hosts whose painters differ by the host's own weight (2). Details in the PR.
    2. For the owner to judge on the pictures (/media/timo/OSM1/tmp/ground-plan/gp6/fade/INDEX.md): region_fade_m = 1.5 m. A region narrower than 3 m whose own painter differs from its neighbours gets a trough with a crease on its centre line (rail-junction). A region edge on a lower slope base rolls down over 1.5 m (cut-region). At a slope tip in a region, the contours kink within 1 m of the tip (region-stub-zoom).
    3. The leg agreement waits for TrailView ground plan GP3 follow-ups: open decisions and review items #3132. No slider page and no prototype "before" pictures.
    4. Not posted: notes on TrailView ground plan GP3R: the records of a cell (one source for near and far) #3135 (rule word, MAGIC 0x4f425205, the rounds' lines) and TrailView ground plan GP4: faces of sidewalks: kerbs, driveways, zebras, corners, ends and buildings #3099 (band faces get no fade until they have a material line). The tool did not let me write on those issues.

    Generated by Claude Code

  11. timohueser commented on Nov 5, 2026

    @timohueser
    OwnerAuthor

    GP6 landed in ground-plan with PR #3140 (merge fb991e0). The adversarial review and its fixes are on the PR. The unnamed steps and the ripple are reported, not gated. The fade's look is judged later, from lit renders.


    Generated by Claude Code

  12. timohueser commented on Nov 6, 2026

    @timohueser
    OwnerAuthor

    Note from the GP6 look work (PR #3163, merged): the toe round's width is now soft-capped by the same line's cut − fill: kq = (w⁻⁴ + c⁻⁴)^(-1/4) in Rust soft_min and WGSL h_soft_min (the hard min first tried made a 2–3° crease along every slope). Unnamed vertical faces over 1 mm: 22,701 → 10,394. Inside-face steps 34 → 33; border bits equal.


    Generated by Claude Code

  13. timohueser commented on Nov 6, 2026

    @timohueser
    OwnerAuthor

    Rule change landed in ground-plan with PR #3169: the toe round's width is multiplied by smoothstep(edge / MARGIN_M) (1 with zero slope at 3 m, 0 at the band's outer edge); edge_room is gone. This removes the crease where the toe's lift was cut by a hard min (main-road-eye fill edge). On paths (reach 3 m = MARGIN_M) the fade spans the whole slope band. Inside-face steps 33 → 32; border bits equal; GPU = Rust within 0.115 mm.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions