Feat: implement WCS↔UCS coordinate transform pipeline

- Add `active_ucs: Option<Ucs>` per-tab state to DocumentTab
- Add `ucs_to_wcs`, `wcs_to_ucs`, `ucs_z_axis`, `ucs_rotated_z` helpers
- Add `Camera::pick_on_plane` for ray–plane intersection against any plane
- Mouse picks project onto the active UCS XY plane instead of world XY
- Typed coordinates are converted from UCS space to WCS before dispatch
- UCS command now really activates/deactivates a UCS:
  - `UCS W` resets to WCS (clears active_ucs)
  - `UCS <name>` activates a named UCS
  - `UCS SAVE <name>` saves the current active UCS
  - `UCS ORIGIN x,y,z` shifts origin (in current UCS space)
  - `UCS X/Y/Z <angle>` rotates the UCS around its own axes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Sonnet 4.6 committed 2026-04-06 14:16:06 +03:00
1 parent 98578cc5c0
commit 20629d587a
5 files changed
+272 -26

No files matched your search

+4
View File
@@ -5,6 +5,7 @@ use crate::snap::SnapResult;
use crate::scene::grip::GripEdit;
use crate::scene::GripDef;
use acadrust::{CadDocument, Handle};
use acadrust::tables::Ucs;
use crate::linetypes;
use std::path::PathBuf;
@@ -28,6 +29,8 @@ pub(super) struct DocumentTab {
pub(super) last_cursor_world: glam::Vec3,
pub(super) history: HistoryState,
pub(super) active_layer: String,
/// Currently active UCS. `None` means WCS (identity transform).
pub(super) active_ucs: Option<Ucs>,
}
impl DocumentTab {
@@ -52,6 +55,7 @@ impl DocumentTab {
last_cursor_world: glam::Vec3::ZERO,
history: HistoryState::default(),
active_layer: "0".to_string(),
active_ucs: None,
}
}