forked from 1b-agent/opencadstudio-upstream
wip(f64): convert command layer to DVec3 (in progress)
Migrate the command/snap/grip/cursor chain from f32 Vec3 to f64 DVec3 so picked points, snaps and grip drags stay precise at UTM-scale coordinates (f32 quantizes to ~0.5 m there). Done so far: - command/mod.rs: EntityTransform, CmdResult points, CadCommand point methods, TangentObject already DVec3 (radius f64). - snap: SnapResult.world DVec3; world_to_screen/try_pt DVec3. - GripApply -> DVec3; grip find/state (GripEdit) f64; camera pick_on_plane_f64 / pick_on_target_plane_f64; scene paper_to_model_f64. - update.rs click + mouse-move + grip-drag pipelines route precise DVec3 to on_point/on_preview_wires/on_entity_pick; ortho/polar cast at the UcsXform boundary only. - cmd_result dispatch, transform helpers, dimension/arc/circle/multileader apply_grip, circle/arc/ellipse/shapes draw commands, array modify. Tree does NOT compile yet (~236 errors remain across modify/annotate/ insert command files + entity apply_grip impls); committed at user request to checkpoint progress. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
96aaf2a293
commit
3da71698b1
18 files changed
+626
-587
No files matched your search
@@ -1,7 +1,7 @@
|
||||
//! OpenCADStudio-style grip editing.
|
||||
|
||||
use acadrust::Handle;
|
||||
use glam::Vec3;
|
||||
use glam::{DVec3, Vec3};
|
||||
use iced::{Point, Rectangle};
|
||||
|
||||
use crate::scene::model::object::{GripDef, GripShape};
|
||||
@@ -23,9 +23,9 @@ pub struct GripEdit {
|
||||
/// `true` → midpoint / translate grip; `false` → endpoint / absolute grip.
|
||||
pub is_translate: bool,
|
||||
/// World-space position of the grip when the drag started (ortho/polar base).
|
||||
pub origin_world: Vec3,
|
||||
pub origin_world: DVec3,
|
||||
/// Last world-space cursor position (needed for incremental delta on translate drags).
|
||||
pub last_world: Vec3,
|
||||
pub last_world: DVec3,
|
||||
}
|
||||
|
||||
// ── Screen-space helpers ───────────────────────────────────────────────────
|
||||
@@ -83,9 +83,9 @@ pub fn find_hit_grip_paper(
|
||||
half_w: f32,
|
||||
half_h: f32,
|
||||
bounds: Rectangle,
|
||||
) -> Option<(usize, bool, Vec3)> {
|
||||
) -> Option<(usize, bool, DVec3)> {
|
||||
let mut best_dist = GRIP_THRESHOLD_PX;
|
||||
let mut best: Option<(usize, bool, Vec3)> = None;
|
||||
let mut best: Option<(usize, bool, DVec3)> = None;
|
||||
|
||||
for g in grips {
|
||||
let screen = Point::new(
|
||||
@@ -97,7 +97,7 @@ pub fn find_hit_grip_paper(
|
||||
let d = (dx * dx + dy * dy).sqrt();
|
||||
if d < best_dist {
|
||||
best_dist = d;
|
||||
best = Some((g.id, g.is_midpoint, g.world.as_vec3()));
|
||||
best = Some((g.id, g.is_midpoint, g.world));
|
||||
}
|
||||
}
|
||||
best
|
||||
@@ -110,9 +110,9 @@ pub fn find_hit_grip(
|
||||
grips: &[GripDef],
|
||||
camera: &crate::scene::view::camera::Camera,
|
||||
bounds: Rectangle,
|
||||
) -> Option<(usize, bool, Vec3)> {
|
||||
) -> Option<(usize, bool, DVec3)> {
|
||||
let mut best_dist = GRIP_THRESHOLD_PX;
|
||||
let mut best: Option<(usize, bool, Vec3)> = None;
|
||||
let mut best: Option<(usize, bool, DVec3)> = None;
|
||||
|
||||
for g in grips {
|
||||
let Some(screen) = camera.project_f64(g.world, bounds) else {
|
||||
@@ -124,7 +124,7 @@ pub fn find_hit_grip(
|
||||
let d = (dx * dx + dy * dy).sqrt();
|
||||
if d < best_dist {
|
||||
best_dist = d;
|
||||
best = Some((g.id, g.is_midpoint, g.world.as_vec3()));
|
||||
best = Some((g.id, g.is_midpoint, g.world));
|
||||
}
|
||||
}
|
||||
best
|
||||
|
||||
Reference in new issue
Block a user