fix(assembly): enforce drag quaternion continuity + short-arc validation (#338) #342

Merged
forbes merged 1 commits from fix/drag-quat-continuity into main 2026-02-27 16:41:58 +00:00
Owner

Two-part fix for the planar constraint drift during interactive drag (#338).

Commit 1: Update solver submodule (solver#40)

_enforce_quat_continuity previously skipped dragged parts, so in a 2-body assembly the function did nothing. Fix:

  • Remove the dragged_ids skip — apply continuity to ALL non-grounded bodies
  • Add Level 2 rotation angle check: if the solved quaternion is >91° from the previous step (matching the C++ validator threshold), reset to the previous quaternion

Commit 2: Short-arc angle in validateNewPlacements

Rotation::evaluateVector() computes angle = 2*acos(w) which gives [0, 2*pi]. When the relative quaternion has w < 0 (opposite hemisphere), the angle exceeds pi even though q and -q represent the same rotation. This caused the validator to report ~350° 'flips' and reject valid solver output.

Fix: map angle to [0, pi] before the 91° threshold comparison.

Testing

  • 291 solver tests pass
  • AssemblyObject.cpp compiles cleanly
  • Console test (solver#39) confirms the solver fix catches branch jumps

Refs: #338, kindred/solver#40

Two-part fix for the planar constraint drift during interactive drag (#338). ## Commit 1: Update solver submodule (solver#40) `_enforce_quat_continuity` previously skipped dragged parts, so in a 2-body assembly the function did nothing. Fix: - Remove the `dragged_ids` skip — apply continuity to ALL non-grounded bodies - Add Level 2 rotation angle check: if the solved quaternion is >91° from the previous step (matching the C++ validator threshold), reset to the previous quaternion ## Commit 2: Short-arc angle in validateNewPlacements `Rotation::evaluateVector()` computes `angle = 2*acos(w)` which gives `[0, 2*pi]`. When the relative quaternion has `w < 0` (opposite hemisphere), the angle exceeds pi even though `q` and `-q` represent the same rotation. This caused the validator to report ~350° 'flips' and reject valid solver output. Fix: map angle to `[0, pi]` before the 91° threshold comparison. ## Testing - 291 solver tests pass - AssemblyObject.cpp compiles cleanly - Console test (solver#39) confirms the solver fix catches branch jumps Refs: #338, kindred/solver#40
forbes added 1 commit 2026-02-27 16:40:58 +00:00
fix(assembly): use short-arc angle in validateNewPlacements (#338)
All checks were successful
Build and Test / build (pull_request) Successful in 30m5s
d174ef7a8d
Rotation::evaluateVector() computes angle = 2*acos(w) which gives
values in [0, 2*pi].  When the relative quaternion has w < 0 (opposite
hemisphere), the angle exceeds pi even though q and -q represent the
same rotation.  This caused the validator to report ~350 degree 'flips'
and reject valid solver output.

Fix: map the angle to [0, pi] before comparing against the 91-degree
threshold.  This is the short-arc equivalent — the minimum rotation
angle between two orientations regardless of quaternion sign convention.
forbes merged commit b1d75fa237 into main 2026-02-27 16:41:58 +00:00
forbes deleted branch fix/drag-quat-continuity 2026-02-27 16:41:58 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#342