Skip to content

feat(edit): add spline-based angle interpolation to context menu#14

Merged
fwrise merged 1 commit into
RI-SE:mainfrom
BastianHavers:dev-edit-spline-angle-interpolation
Apr 15, 2026
Merged

feat(edit): add spline-based angle interpolation to context menu#14
fwrise merged 1 commit into
RI-SE:mainfrom
BastianHavers:dev-edit-spline-angle-interpolation

Conversation

@BastianHavers
Copy link
Copy Markdown
Contributor

@BastianHavers BastianHavers commented Apr 15, 2026

Summary

Note

This is the PR analogous to the one for markit, #13, only this one enables it for edit as well

Add a right-click context menu action "Spline interpolate angles…" to the edit application that fits a cubic spline to a vehicle's bounding box trajectory and orients all bounding box angles along the spline tangent.

Features

  • Two modes: Entire trajectory or user-specified frame range
  • Configurable smoothing factor (splprep s= parameter, default 0.0)
  • Warning confirmation before overwriting existing angles
  • Fully undoable via Ctrl+Z (SplineAngleCommand)
  • Handles stationary vehicles (repeated positions) via forward-fill

Architecture (MVC pattern)

Layer File What
Service interpolation_service.py Pure-math spline_interpolate_angles() static method
Service annotation_service.py apply_spline_angle_interpolation() orchestration
Controller annotation_controller.py @error_handler wrapper
Gateway gateways.py Protocol + implementation extension
Undo commands.py SplineAngleCommand with geometry snapshots
Dialog spline_angle_dialog.py QDialog: mode, smoothing, warning
Menu _annotation_spline_ops.py Context menu handler

Tests

19 new unit tests covering:

  • Pure-math spline angle computation (straight lines, curves, stationary frames, edge cases, smoothing)
  • Deduplication helper
  • Annotation service integration (full trajectory, frame range, error handling)

All 144 edit tests pass. Lint clean.

Dependencies

Added scipy>=1.10.0 to the edit dependency group (already present for markit).

Add a right-click context menu action 'Spline interpolate angles...' that
fits a cubic spline to a vehicle's bounding box trajectory and orients all
bounding box angles along the spline tangent.

Features:
- Two modes: entire trajectory or user-specified frame range
- Configurable smoothing factor (splprep s= parameter, default 0.0)
- Warning confirmation dialog before overwriting existing angles
- Fully undoable via Ctrl+Z (SplineAngleCommand)
- Handles stationary vehicles (repeated positions) via forward-fill
- 19 new unit tests for spline math and annotation service integration

Architecture (MVC pattern):
- InterpolationService: pure-math spline_interpolate_angles() static method
- AnnotationService: apply_spline_angle_interpolation() orchestration
- AnnotationController: @error_handler wrapper
- AnnotationGateway: protocol + ControllerAnnotationGateway extension
- SplineAngleCommand: undoable command with before/after geometry snapshots
- SplineAngleDialog: QDialog with mode selection, smoothing config, warning
- Context menu integration via _annotation_spline_ops.py

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@fwrise fwrise merged commit 71d46cf into RI-SE:main Apr 15, 2026
3 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