Skip to content

viewer: two-point align for federation — rotation and move from two point pairs, with a check line #11505

Todo

Description

@petruconduraru

Problem

To federate a model, the Reposition tool (Placement panel → Local → Reposition models) supports a point-to-point move (source point → target point, with a ΔX/ΔY/ΔZ readout) and a typed rotation about a pivot. The rotation is the hard part. For models that are not georeferenced, nothing in the UI shows a model's orientation, so the angle has to be measured by hand and computed.

Proposal: two-point align (as in CAD ALIGN)

  1. Pick A on the moving model and A′, the matching point, on the reference.
  2. Pick B on the moving model and B′ on the reference, ideally far from A.
  3. Compute the rotation about the vertical axis from the plan direction A→B to A′→B′, and the translation that puts A on A′.
  4. Preview it and show a readout before applying:
    • rotation in degrees, with pivot A;
    • ΔX, ΔY, ΔZ;
    • a check line: how far B lands from B′ after the transform, so a wrong pick or a scale or unit mismatch is visible.
  5. Apply with undo, and a Copy transformation button that copies the readout as text.

This reuses the existing pick flow, including per-role eligibility (#11419), rotation about a pivot, translation, and undo. It pairs with #11504 (CAD-style corner snapping) for reliable corner picks, but does not depend on it.

Activity

  1. petruconduraru commented on Nov 25, 2026

    @petruconduraru
    CollaboratorAuthor

    Implementation on branch feat/11505-two-point-align (a1c7f8f):

    • lib/model-placement/two-point-align.ts computes heading, pivot, move and the check.
    • two-point-align-apply.ts and an alignModels store action commit it as one undoable step, composed with each model's existing heading.
    • A TwoPointAlignPanel in the Local tab, with keys in en/de/fr/it/ru.
    • Revert-oracle evidence is in tests/evidence/two-point-align-11505/.

    The math, apply and session tests pass locally (30). With the evidence mutation applied, 16 of them fail. The panel test needs built package dists and is left to CI.

    Known limit: the heading absorbs a sideways miss of B′, so the check line exposes a length, scale or Z mismatch, not a mis-picked B′ at the right distance. I'll open the PR once this issue is triaged.

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions