Skip to content

Step 2: clip loop-closure target preview by intersection slab - #587

Merged
JanuszBedkowski merged 1 commit into
mainfrom
mp/step2-loop-closure-intersection
Oct 29, 2026
Merged

JanuszBedkowski merged 1 commit into
mainfrom
mp/step2-loop-closure-intersection

Conversation

@michalpelka

Copy link
Copy Markdown
Contributor

Problem

In step 2's loop closure mode with Manipulate active edge on, the blue (target) cloud ignored the xz/yz/xy intersection slab. The red (source) cloud was clipped as expected.

Cause

  1. The active-edge preview draws the target scans with ScanRenderer::drawCachedWithTransform() but did not pass the intersection flags, so they defaulted to off.
  2. The point shader evaluated the slab, the Measurements clip planes, and the Elevation/Distance gradients on the cached vertex position. The preview delta was folded only into the MVP, so a moved preview would be clipped where the scan is stored, not where it is drawn.

Fix

  • Pass xz/yz/xy_intersection and intersection_width to the target preview draw.
  • Add a model uniform to the point shader, applied before fragWorldPos. The pose delta goes there instead of into the MVP. All four shader users (draw, drawCachedWithTransform, drawPoints, drawTrajectories) set it, since an unset mat4 uniform is zero.

Side effects (corrections): "Show with initial pose" in step 2 and step 3's posed session previews now clip and colour by the displayed position.

Testing

  • Step 2 and step 3 build, and clang-format 21 is clean.
  • Not yet checked in the GUI: in step 2, open loop closure, enable an intersection and Manipulate active edge, move the edge, and the blue cloud should stay clipped to the slab.

🤖 Generated with Claude Code

In loop closure "Manipulate active edge" mode the blue target scans were
drawn without the xz/yz/xy intersection flags, so they ignored the slab
while the red source was clipped.

The point shader also tested the slab (and Elevation/Distance gradients)
against the cached position, with the preview delta folded only into the
MVP, so a moved preview would be clipped at its stored pose. Apply the
delta as a separate model matrix before fragWorldPos instead; this also
fixes "Show with initial pose" and step 3's posed session previews.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JanuszBedkowski
JanuszBedkowski merged commit 0b08144 into main Oct 29, 2026
7 checks passed
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.

2 participants