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:
Hakan Seven 2026-06-24 03:32:11 +03:00
commit 3da71698b1
18 changed files with 626 additions and 587 deletions

View file

@ -3,7 +3,7 @@ use acadrust::entities::{
DimensionDiameter, DimensionLinear, DimensionOrdinate, DimensionRadius,
};
use acadrust::Entity;
use glam::Vec3;
use glam::{DVec3, Vec3};
use crate::command::EntityTransform;
use crate::entities::common::{
@ -540,21 +540,22 @@ where
}
}
fn rotate_point(p: &mut acadrust::types::Vector3, center: Vec3, angle_rad: f32) {
let dx = p.x as f32 - center.x;
let dy = p.y as f32 - center.y;
let (s, c) = angle_rad.sin_cos();
p.x = (center.x + dx * c - dy * s) as f64;
p.y = (center.y + dx * s + dy * c) as f64;
fn rotate_point(p: &mut acadrust::types::Vector3, center: DVec3, angle_rad: f32) {
let dx = p.x - center.x;
let dy = p.y - center.y;
let (s, c) = (angle_rad as f64).sin_cos();
p.x = center.x + dx * c - dy * s;
p.y = center.y + dx * s + dy * c;
}
fn scale_point(p: &mut acadrust::types::Vector3, center: Vec3, factor: f32) {
p.x = (center.x + (p.x as f32 - center.x) * factor) as f64;
p.y = (center.y + (p.y as f32 - center.y) * factor) as f64;
p.z = (center.z + (p.z as f32 - center.z) * factor) as f64;
fn scale_point(p: &mut acadrust::types::Vector3, center: DVec3, factor: f32) {
let f = factor as f64;
p.x = center.x + (p.x - center.x) * f;
p.y = center.y + (p.y - center.y) * f;
p.z = center.z + (p.z - center.z) * f;
}
fn mirror_point(p: &mut acadrust::types::Vector3, p1: Vec3, p2: Vec3) {
fn mirror_point(p: &mut acadrust::types::Vector3, p1: DVec3, p2: DVec3) {
crate::scene::view::transform::reflect_xy_point(&mut p.x, &mut p.y, p1, p2);
}
@ -582,16 +583,16 @@ fn dv3(v: &acadrust::types::Vector3) -> glam::DVec3 {
glam::DVec3::new(v.x, v.y, v.z)
}
fn set_v3(target: &mut acadrust::types::Vector3, p: Vec3) {
target.x = p.x as f64;
target.y = p.y as f64;
target.z = p.z as f64;
fn set_v3(target: &mut acadrust::types::Vector3, p: DVec3) {
target.x = p.x;
target.y = p.y;
target.z = p.z;
}
fn translate_v3(target: &mut acadrust::types::Vector3, d: Vec3) {
target.x += d.x as f64;
target.y += d.y as f64;
target.z += d.z as f64;
fn translate_v3(target: &mut acadrust::types::Vector3, d: DVec3) {
target.x += d.x;
target.y += d.y;
target.z += d.z;
}
fn apply_to_v3(target: &mut acadrust::types::Vector3, apply: &GripApply) {