Repository navigation
Description
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 fromheight_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) andscratch/one-model-q4(cc72be8, with the leg split). Rustfaces/heights.rs, WGSLterrain/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/); WGSLheight_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,
MAGIC0x4f425201). 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'sfill_maxandcut_max; head and candidate hold 11 words each;findreturns only the label. GP6 ports the prototype's functions onto this layout. - The prototype keeps at most
SLOTS= 8 lines at a point andQUADS= 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.
- 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 (
- 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) andmodel_at(WGSL) give the label. - GP1:
Terrain::height(T), the Mercator scale. data/trailview/plan.jsonblockheights; the class fields ofroads.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)
owneris the host line of a paved point, the line whose cone holds a slope point, elseu32::MAX.stepnames the rule that moves this side off the other side at a face edge (section 6). It replaces the prototype'swall: bool.startisModelPoint.heights, or 0 to walk the bin's candidates first. GP6 addsModelPoint.heightstofind'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'smodel_atgives the same.- In GP3R's encoders (each a layout change, so
MAGICchanges): the line wordsfill_maxandcut_maxfrom 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
heightsinfaces/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 pastleg_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 abovedz_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_mbefore 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.jsonrank, 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 rulekerb offsettakes 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 firstround_m. A cone lets go toward ±∞ over the lastfade_shareof 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_maxorcut_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 leasttoe_gap_min, from the terrain's grade outward (the plane of the two reach terrains of the sample). So the round is abouttoe_span_mwide whatever the gap, and exact at the road edge. - Band fade: within
band_fade_mof 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.legsselectsramp(R: one cone pair per line, the legs meet in a ramp ofleg_reach_m) orwall(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, prototypefaces/legs.rsonscratch/one-model-q4). The value isrampuntil 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:
- 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. - 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 plusleg_reach_m(part of request 1). - One order. Every sum runs in the global key's order, not in the bin's item order.
- Caps by the global key. Where
SLOTSorQUADSdrop records (section 8), they keep the first by the global key, never by bin order. - T(q). GP1's
Terrain::heightreads 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. - 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), andModelPoint.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::Kerbtoheight_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_sidesat every edge vertex,height_atat every other vertex and for the normals, andHeight.stepfor the vertical face's material. It takes the owned region from GP3's faces, not from GP6. - GP8 takes
heights.wgsland calls it per texel aftermodel_at, withstart. GP8 measures the GPU cost of the heights in its stamp. - GP12 takes
Step::StructureEndand 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;
CutWinsup 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:
Unrelatedon 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
- Move
heights.rsandheights.wgslfromscratch/one-model-q4(cc72be8) into the crate and the viewer, as they are, with the prototype's line surface. RemoveQ4,IDEAS,PROBEand the per-quad cones;heights.legsselects R or W. Trace open item 6 on this commit, then measure the inside-face count on it; the PR names the commit. - The block
heightsinplan.json, the class fields inroads.json, the reader infaces/rules.rs; the line wordsfill_maxandcut_maxin GP3R's encoders. Height.step, the classification and the size check of section 6 inheight_at_sides; the WGSL returns the kind only.- 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. - The tight-bend rule of section 1 (candidate (a) first, with its stop rule), then the leg agreement of section 2 (for W).
- The tests and the bench (Verification); the debug tool's
heightscommand 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 blockheights, the module.host/obc-ground-plan/src/faces/records.rs(GP3R's encoders): change: the line wordsfill_maxandcut_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.mjsand 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, namedUnrelated, 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, withrampand withwall; 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_steps0 with the size check;host_missing0;slots_full0; 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.mjsinnpx vitestor the trailview browser tests, one GPU user at a time withflock /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.
- 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
- 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_sidesagainst 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).
- 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;
- 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_atandheight_at_sidesrun in the crate andheights.wgslin 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_missingandslots_fullare 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
- A C1 rule inside tight bends (section 1).
- 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).
- Junction-ramp curvature (section 3).
- 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). - 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. - 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.
- 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
- 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.
- The path values:
fill_max3.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. - 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.
- 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}andHeightStatsgo. - 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_min place of the exponential'sleg_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)
- Rule block: no
wall_face_m,wall_min_m,wall_m(no GP6 reader; GP7 and GP16 add them with their readers).via_fade_mgives both relations (a fan's and a third line's), each fading over it before the feather.window_m,blend_radius_mand their check go. - The rule values travel in the records after the head (
MAGIC0x4f425203), so both ports read the same words. - 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 withinband_fade_mbefore a level end line. - 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).
- The painter orders equal classes by the glob order of the line's first sample.
- The host is never kept off by a lesser record.
- 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). - No surface past a level end: rejected (inside steps on the end line's extension).
- Rust
findstays label-only;heights.wgsltakesstart(0: walk the bin). - 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).
SLOTSis 10 (the fixture has 9 lines at one point); the cap keeps the labels' material lines.- 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_mandhealth_width_m, so the whole carriageway has full health. A mitre stays withinframe_tilt_deg(30, in the block in place ofhealth_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. - The fixture suite gates
unnamedat 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. - 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 withinMARGIN_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 toMARGIN_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 checkslots_fullcounts 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,CutWinsby 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_mon, and a bin lists every edge up toMARGIN_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 mostMARGIN_M(the reader refuses a greater value). The rule words grow by one:MAGIC0x4f425205.
- 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,
- 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.
- 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
timohueser commentedon Nov 3, 2026
Deviation from GP1 (PR #3117), for this sub-issue:
Terrain::new(key, pages)takes the cell key and keeps only the pages thatTerrain::wanted(key)lists, so heights depend on the cell alone.Terrain::heightis defined only inside the cell grown by its margin and answersNonepast level 13; handleNone, do not query outside that square.timohueser commentedon Nov 4, 2026
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.
c + reach_mof a segment of its centre line (the union of the capsules), withc = half_m + shoulder_m(GP1 has noverge_m). The flat end of a structure lies inside the same capsules.c + reach_mof a segment of its line". No mitre corner, no(c + reach_m) / cos(θ/2).HALF_MAX_M + shoulder + reach_m= 15 + 0.6 + 10 = 25.6 m, sowindow_mplus it plus 2 m is 86 + 25.6 + 2 = 113.6 m, not 124.2 m.c + reach_mabout the vertex.Generated by Claude Code
timohueser commentedon Nov 4, 2026
Deviation from GP4 (#3099, redesigned): what GP6 gets for sidewalks
KerbProfile. GP4 builds nosrc/wedge.rsand writes noframe_margin_morframe_slack_m. GP6 builds any frame it needs from GP3's samples. GP4 writes noKerbProfile,Taper,DroporKerbId.FacePlan.kerbs: Vec<KerbEdge { edge, marks: Vec<KerbMark { t, rise_m, front_m }> }>. EachKerbedge carries marks at both ends and at every breakpoint of the riseR(taper start, fillet points) and of the step heightF(lowered-kerb ramps). Values are linear between marks. At a sidewalk point, the nearestKerbedge of its own face givesz,R,Fand the distanced. The height isz + F + (R − F) · min(1, d / a) + cross-fall, whereais GP6'skerb_ramp_across_m.Kerbwhere that face belongs to the chain's road, its junction, or another road the sidewalk runs into.Continuousand flush at a stop mouth (path, track, steps, driveway).ContinuouswithUNRELATEDelsewhere (rule 6).UNRELATEDedge.R = 0.Generated by Claude Code
timohueser commentedon Nov 4, 2026
Interface change from GP8 (owner approved, see #3102):
smoothstep(floor_range, plan_range, distance). GP9'svertex_mainandpiece_placepass the same snap flag, so terrain and strip vertices agree bit for bit. GP9 addsfloor_rangeandplan_rangetoSurfaceand counts strip vertices with a snap word ≠ 0 (target 0). I6 now reads: "No vertex withinfloor_rangemoves. No strip vertex moves."r(≤ 9 m) past an arm's own footprint, inside the corner's fan; GP6's owned region (I1) must cover this.acrosscode is finer (an asinh scale) on the new path only.Generated by Claude Code
timohueser commentedon Nov 5, 2026
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 inone-model/PROPOSAL-heights.md.What GP6 becomes
GP6 is one point function over the records of a cell:
wordsis the cell block of the records (GP3's candidates, lines and samples,faces::records).qis in frame units from the cell origin.labelis the label offind/model_atatq.tis the plain terrain atq.qandt. It reads no other terrain point and no other cell.model_at. The two ports agree to 2 mm.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
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 (weightexp(−Δ / 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.β = φ(d / L):φ= 1 − smoothstep,L= feather = the line's slope reach (at least 1 m). Two records agree byγ: 1 belowdz_wall / 2, 0 abovedz_wall. For roadsdz_wallis 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.roads.jsonrank, rails first). A greater record rules a lesser one by1 − β · 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.G = smin(cut, smax(T, fill, k), k).kgrows 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.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.Gfades intoT. So the ground is the terrain at the band edge, for every band shape.Proposed rule values (a
heightsblock inplan.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_steep1.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 inroads.json:fill_max1.5 andcut_max2 for roads, tracks and rails; 3 and 3 for paths and steps (the body hasfill_max1.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
β= 1 on the core edge for both labelstand the scale at qMeasured numbers
Open items
Parts proven enough to port into production now
γwith the approved 0.5 / 1.0 m, and the painter in height-key order with host weights.fill_maxandcut_max.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
timohueser commentedon Nov 5, 2026
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.mdsections 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_atover the records of a cellStatus: 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 toheight_atlater.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)inhost/obc-ground-plan/src/faces/heights.rsandbuilder/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 blockheightsofplan.json.Rejected:
z_grad): GP7 takes its normals fromheight_at(GP7 section 5).heights/q4b/), and both options that the owner considers (R and W) replace them. Question 1 below.height_at(GP8).Systems: trailview
Contracts: none. Rule values go into
data/trailview/plan.json(blockheights) and into the class fieldsfill_maxandcut_maxofdata/trailview/roads.json, outsideCLASS_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
scratch/one-model-heights(round 5, e6c2aa1) andscratch/one-model-q4(round 6, cc72be8, with the leg split). Rustfaces/heights.rs, WGSLterrain/heights.wgsl, a line-for-line port. Not for merge.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/); WGSLheight_at(block, q, label, t) -> vec2f(h, kind).fill_maxandcut_max. GP3R fixes the layout.SLOTS= 8 lines at a point andQUADS= 4 quads per line (the GPU port holds the same).heights/round5/).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.heights/round6/). The causes at the four places: legs that blend, the fallback star, junction ramps, the cut's mitre line.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/).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
feather_min_m.Data that GP6 reads
find(Rust) andmodel_at(WGSL) give the label.model_atalso gives the first word of the bin's height lists (ModelPoint.heights), so the stamp walks the bin once (GP8).Terrain::height(T), the Mercator scale.data/trailview/plan.jsonblockheights; the class fields ofroads.json.Data that GP6 writes
owneris the host line of a paved point, the line whose cone holds a slope point, elseu32::MAX.stepnames the rule that moves this side off the other side at a face edge (section 6). It replaces the prototype'swall: bool.startisModelPoint.heights, or 0 to walk the bin's candidates first.heightsinfaces/rules.rs(the prototype reads it there already).1. The line surface
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_stretch; the stretch steepens the grade, and the steepening jumps on every mitre line.leg_blend_m).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.2. Presence and agreement
dz_wall/ 2 and 0 abovedz_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).via_fade_mbefore the third line's feather, where it leaves the records.q4w/). Proposed by q4w, not built.3. The paved field
roads.jsonrank, rails first.Step::Kerb). GP4 adds it in Rust and WGSL. Until then, the rulekerb offsettakes P.4. The slope field
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 firstround_m. A cone lets go toward ±∞ over the lastfade_shareof its reach, by its own distance.fill_maxorcut_max. The rest, Δ, is a wall at the road edge: a fill wall downhill, a cut wall uphill.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 leasttoe_gap_min, from the terrain's grade outward (the plane of the two reach terrains of the sample). So the round is abouttoe_span_mwide whatever the gap, and exact at the road edge.band_fade_mof the slope band's outer edge, G fades into T. So the ground is T at the band's edge, for every band shape.heights.legsselectsramp(R: one cone pair per line, the legs meet in a 0.25 m ramp) orwall(W: the nearer leg alone, the leg walls on a face edge; it needs GP3's leg split,faces/legs.rsonscratch/one-model-q4). The value isrampuntil 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_sidesnames it from the two sides:NoRoomCutWinsownerdiffers from the paved side's host)RailRoadCutWinsorUnrelatedwhere one side's line is a rail line and the other's a roadUnrelatedStructureEndKerbA step over
step_mwithStep::Noneon both sides is a fault (checkunnamed_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
8. Capacity
SLOTS(8 lines at a point) andQUADS(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 (checkslots_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
heightsindata/trailview/plan.json(the crate only reads it), and two class fields inroads.json. No value lives in code.heights.feather_min_mheights.blend_steepdz_wall= return grade × feather /blend_steepgives the owner's 1.0 m for two roadsheights.leg_blend_mheights.health_margin_m,health_width_m,health_stretchheights.round_mheights.fade_share,fade_gap_mheights.toe_per_m,toe_max_mheights.toe_span_mheights.toe_gap_minheights.via_fade_mheights.band_fade_mheights.wall_face_m,wall_min_mwall_min_m, lies on the wall's faceheights.mitre_band_mheights.legsrampramporwallheights.step_mheights.wall_mfill_maxcut_maxdz_wallReason 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 behindcfg(test).Invariants and how each is proven
unnamed_steps0; the worst three steps of each rule as picturesmodel-probein the browser tests: ≤ 2 mm, kinds equalInterfaces with the other items
find,model_atwithModelPoint.heights, the derived words in global f64 (section 7), and the label words that heights read (material line, rail line, arms 4–11).faces/legs.rs) and one band candidate per way and layer (ground-plan: a junction guest wider than every other arm tapers into them (GP3 follow-ups) #3134). With ground-plan: a junction guest wider than every other arm tapers into them (GP3 follow-ups) #3134, round 5's 3 band-face steps get a material line.Step::Kerbtoheight_at, in Rust and WGSL, and the kerb's height vectors to the tests.height_at_sidesat every edge vertex,height_atat every other vertex, andHeight.stepfor the vertical face's material. It takes the owned region from GP3's faces, not from GP6.heights.wgsland calls it per texel aftermodel_at, withstart.Step::StructureEndand builds the faces at structure ends. GP13 keeps rails first in the height key. GP14 adds water lines as records and their profiles.Edge cases
CutWinsup to the upper road. With W and the split, the legs' wall stands on the medial face edge.Unrelatedon the greater core edge.RailRoad, a retaining wall.StructureEnd; until GP12 the end line steps to the terrain.Plan
heights.rsandheights.wgslfromscratch/one-model-q4(cc72be8) into the crate and the viewer, as they are, with round 6's line surface. RemoveQ4,IDEAS,PROBEand the per-quad cones;heights.legsselects R or W.heightsinplan.json, the class fields inroads.json, the reader infaces/rules.rs.Height.stepand the classification of section 6 inheight_at_sides; the WGSL returns the kind only.heightscommand 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 blockheights, 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.mjsand its test: create (or change GP3R's): Rust = GPU for heights.data/trailview/plan.json,data/trailview/roads.json: change: the Rule block.Verification
obc test -p obc-ground-plan,obc exec cargo clippy -p obc-ground-plan --all-targets -- -D warnings,cargo fmt --all):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, namedUnrelated); 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, withrampand withwall. A test for each rule field: the reader refuses a table without it.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_steps0;slots_full0; 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, 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.model-probe.mjsinnpx vitestor the trailview browser tests, one GPU user at a time withflock /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.builder/web:npm run check:wgsl.height_at_sidesagainst 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.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.--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):Done when
height_atandheight_at_sidesrun in the crate andheights.wgslin the viewer, line for line.unnamed_stepsandslots_fullare 0.Out of scope
find/model_at: GP3R. The leg split and band ownership: GP3.Open items that GP6 carries (from the port note)
shapes/owner1/4b, 4c).shapes/owner2/crop-mr15-top-left.png,crop-ctor-track.png): not looked at.shapes/owner1/4a fixed the corner band's paint).Questions for the owner
fill_max3.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.What changed from the approved body, and why
wedge.rs(sections 2 and 11), the 86 m window,Heights::{z, z_grad, frame}andHeightStatsgo.height_at.Generated by Claude Code
timohueser commentedon Nov 5, 2026
Status of GP6: draft PR #3140 (branch
claude/gp6-heights, head e9ac916).Done:
height_at,height_at_sides(withHeight.step) infaces::heights;heights.wgslline for line, withrecords.wgslandmodel-words.wgslfor the block's words. Rule values inplan.jsonblockheightsand the class fieldsfill_max,cut_max; the records carry them (MAGIC0x4f425203).slots_full0;host_missing0; 245,760 of 245,760 border points bit-equal (heights and terrain).height_at_sides0.59 times two calls.heights_fixture(42 s).Left:
/media/timo/OSM1/tmp/ground-plan/gp6/step5/. The ripple gate fails at v17 (4.43 mm) and i07 (3.60 mm) until then.gp6/pictures/INDEX.md).Deviations from this body (also in the PR):
wall_face_m,wall_min_m,wall_m(no GP6 reader; GP7 and GP16 add them with their readers).via_fade_mgives both relations (a fan's and a third line's), each fading over it before the feather.window_m,blend_radius_mand their check go.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 withinband_fade_mbefore a level end line.toe_max_m, span height) with one C1 curve (the min had a kink: a crease along the slope).findstays label-only;heights.wgsltakesstart(0: walk the bin).SLOTSis 10 (the fixture has 9 lines at one point); the cap keeps the labels' material lines.unnamedat 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
timohueser commentedon Nov 5, 2026
Status of GP6 after step 7a: draft PR #3140 (branch
claude/gp6-heights, head 5954c49).Done in this session:
health_margin_m+health_width_m), withinframe_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./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.slots_full0,host_missing0. GPU = Rust: 115,786 points at six places, max 0.397 mm, kinds equal.obc test -p obc-ground-planpassed, clippy clean, fmt clean,check-wgslvalidates. One new Rust unit test (the frame); no browser test.Left:
via_fade_mgives 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.unnamed0) 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 withworst_at),--why LAT,LON,--places ... --at NAME=LAT,LON --size-m 16for zooms,--gpu-checkthenmodel-probe.mjsunderflock /tmp/trailview-gpu.lockwith Node 22 on PATH. Build withobc exec env CARGO_TARGET_DIR=/media/timo/OSM1/cache/cargo-target-gp6 cargo ....Generated by Claude Code
timohueser commentedon Nov 5, 2026
Owner decisions (2026-11-05):
Next for GP6:
Generated by Claude Code
timohueser commentedon Nov 5, 2026
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:
records::blend_edges), up toregion_fade_m(1.5 m, proposed, at mostMARGIN_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.slots_full,host_missingThe 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:
/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).MAGIC0x4f425205, 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
timohueser commentedon Nov 5, 2026
GP6 landed in
ground-planwith 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
timohueser commentedon Nov 6, 2026
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 Rustsoft_minand WGSLh_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
timohueser commentedon Nov 6, 2026
Rule change landed in
ground-planwith PR #3169: the toe round's width is multiplied bysmoothstep(edge / MARGIN_M)(1 with zero slope at 3 m, 0 at the band's outer edge);edge_roomis 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