Skip to content

feat(editor): see a lidar tile in the scene, and turn it into ground (p7-s3) (#243) - #493

Merged
JArmandoAnaya merged 2 commits into
mainfrom
feat/243-p7-s3-lidar-editor
Jul 29, 2026
Merged

JArmandoAnaya merged 2 commits into
mainfrom
feat/243-p7-s3-lidar-editor

Conversation

@JArmandoAnaya

Copy link
Copy Markdown
Contributor

The editor half of #243 (p7-s3), on top of the kernel that landed in #492.
A point cloud becomes the third ReferenceLayerKind, imported with
File ▸ Import ▸ Point Cloud… and turned into terrain with
Edit ▸ Terrain ▸ Seed from Point Cloud….

Everything Layer 2 already guarantees is inherited unchanged: the relative-path
contract, re-derivation when the frame changes, the per-entry sidecar tolerance,
and the ruling that adding a layer is not an undoable command. Seeding
terrain is, and goes through the same edit::set_terrain_field the DEM and
elevation-raster paths use — one undo entry, every p5-s2 invariant inherited.

Two things a cloud does not inherit from an imagery underlay

It is not flattened. Vectors and rasters are backdrops drawn at a fixed
height just above the ground. A cloud has real Z and draws depth-sorted with the
scene, because its heights are the reason it was imported at all.

Its vertices stay in the cloud's own frame, with PointCloud::origin
travelling as the draw's single InstanceData model matrix. Baking the origin
into the vertex buffer would put a scene-scale value back into a float and
reintroduce exactly the terracing the offset representation exists to prevent —
the same defect the kernel's own precision test guards, one layer further out.

Per-point colour needed no vertex-format change: each point's normalised height
goes in uv.x and a generated 256×1 ramp is sampled through the existing
Material::base_color path.

The primitive path is now a switch

Drawing points needed a third PrimitiveKind, and the renderer chose its GL
primitive with a two-way ternary — kind == Triangles ? kTriangles : kLines.
A third enumerator added without touching that line would have drawn the cloud as
line segments between consecutive points: silently, no warning, no error,
just garbage. Both that site and the two-way branch in the layer-bounds
computation are switches now, and a named test pins each.

The sidecar's kind stops being a bool

SceneReferenceLayer::vector becomes the same ReferenceLayerKind the runtime
uses, so a third spelling cannot exist in one and not the other. Sidecars written
before this carry only "vector" and "raster" and load unchanged; an unknown
spelling still reads as a raster with a warning rather than dropping the layer.

★ It also wires up a path that shipped dead

Document::refit_reference_layers() was added by #242 and called from
nowhere.
Reopening a scene re-derived its layers, but changing the georeference
live left them wherever the old frame had put them — over the wrong ground,
with no warning.

GW-2 step 31 asks a hand-runner to check exactly this, and its pass criterion
already said a build that mishandles it fails the run. So the gap was written
down before it was closed. #243 would otherwise have added a third layer kind
inheriting the same dead path.

Docs

  • GW-2 steps 34–37 and three pass criteria. The sharpest: the cloud and the
    imagery must land on each other — they are read by different parsers but
    share one CrsTransform, so a visible offset between them is a projection bug
    in one of the two, and this is the cheapest place in the whole workflow to
    notice one.
  • docs/domain/gis.md gains the editor half of the point-cloud section.
  • CHANGELOG.md under [Unreleased] ### Added, written from the shipped tr()
    strings.

Verification

  • cmake --build --preset ci-macos (-Werror) clean; ctest --preset ci-macos
    2627/2627.
  • ASan + UBSan over the editor test binary: 1088 tests, zero sanitizer
    findings
    .
  • git ls-files '*.cpp' '*.hpp' | xargs clang-format --dry-run --Werror clean
    (CI's exact command).

Sabotage matrix — six neutralisations, each rebuilt and re-run

Runtime neutralisations rather than deletions, each echoing the build's exit code
so a sabotage that failed to compile cannot report green off a stale binary. All
six fired on the first attempt.

# Neutralised Gate that fired
1 Apply no longer refits the reference layers (the pre-#243 dead path) ApplyingANewFrameReDerivesTheImportedLayers
2 the cloud claims Lines — what the old two-way ternary drew PointsAreNotDrawnAsLines
3 the origin is baked into the float vertices PositionsStayInTheCloudsOwnFrame
4 a point-cloud layer is persisted as "raster" RoundTripsThroughTheSceneContainer
5 an imported cloud is never moved into the scene's frame ImportingALidarTilePlacesItAndReportsWhatItRead, AChangedGeoreferenceReDerivesACloudToo, ApplyingANewFrameReDerivesTheImportedLayers
6 a flat cloud normalises over a zero range AFlatCloudDoesNotDivideByItsOwnZeroRange

Closes #243. Pillar P7, epic #256.

…(p7-s3)

The editor half of #243. A point cloud becomes the third
ReferenceLayerKind, imported with File > Import > Point Cloud... and
turned into terrain with Edit > Terrain > Seed from Point Cloud...

Everything Layer 2 already guarantees is inherited unchanged: the
relative-path contract, re-derivation when the frame changes, the
per-entry sidecar tolerance, and the ruling that adding a layer is not
an undoable command. Seeding terrain is, and goes through the same
edit::set_terrain_field the DEM and elevation-raster paths use, so it is
one undo entry.

Two things a cloud does NOT inherit from an imagery underlay:

- It is not flattened. Vectors and rasters are backdrops drawn at a
  fixed height; a cloud has real Z and draws depth-sorted with the
  scene, because its heights are why it was imported at all.

- Its vertices stay in the cloud's own frame, with the origin carried as
  the draw's single instance matrix. Baking the origin into the vertex
  buffer would put a scene-scale value back into a float and reintroduce
  the terracing the offset representation exists to prevent -- the same
  defect the kernel guards, one layer further out.

THE PRIMITIVE PATH IS NOW A SWITCH. Drawing points needed a third
PrimitiveKind, and the renderer chose its GL primitive with a two-way
ternary: `kind == Triangles ? kTriangles : kLines`. A third enumerator
added without touching that line would have drawn the cloud as LINE
SEGMENTS BETWEEN CONSECUTIVE POINTS -- silently, no warning, no error.
Both that site and the two-way branch in the layer bounds are switches
now, and a named test pins each.

THE SIDECAR'S `kind` STOPS BEING A BOOL. It is the same enum the runtime
uses, so a third spelling cannot exist in one and not the other. Older
sidecars carry only "vector" and "raster" and load unchanged; an unknown
spelling still reads as a raster with a warning rather than dropping the
layer.

ALSO WIRES UP A PATH THAT SHIPPED DEAD. Document::refit_reference_layers()
was added by #242 and called from nowhere: reopening a scene re-derived
its layers, but changing the georeference LIVE left them over the wrong
ground. GW-2 step 31 asks a hand-runner to check exactly that, and its
pass criterion already said a build which mishandles it fails the run --
so the gap was written down before it was closed. #243 would otherwise
have added a third layer kind inheriting the same dead path.

GW-2 gains steps 34-37 and three pass criteria, the sharpest being that
the cloud and the imagery must land on each other: they are read by
different parsers but share one CrsTransform, so a visible offset
between them is a projection bug and this is the cheapest place in the
workflow to notice one.

Closes #243.
@JArmandoAnaya JArmandoAnaya mentioned this pull request Jul 29, 2026
6 of 18 tasks
Both arrive transitively through libc++ on macOS and not through Linux
clang, which is exactly how #492 shipped a green local build that broke
CI on the same class of omission.
@JArmandoAnaya
JArmandoAnaya merged commit 7d089d3 into main Jul 29, 2026
15 checks passed
@JArmandoAnaya
JArmandoAnaya deleted the feat/243-p7-s3-lidar-editor branch July 29, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

p7-s3: lidar import (PDAL)

1 participant