feat(f64): command layer compiles on DVec3

Whole command/snap/grip/cursor chain now builds on f64 DVec3 end to end,
so picked points, snaps and grip drags stay precise at UTM-scale
coordinates instead of quantizing to ~0.5 m through f32.

- All ~80 command files migrated: draw (line/circle/arc/ellipse/shapes
  in full f64; others via point methods), modify, annotate, insert, view,
  inquiry, layers, groups, clipboard, layout.
- Entity apply_grip impls updated for GripApply::{Absolute,Translate}(DVec3).
- Construction sites (EntityTransform/CmdResult/DynAnchor) emit DVec3;
  wire-preview boundaries cast to f32 only at the GPU edge.
- Modify/annotate commands keep internal Vec3 geometry where precision is
  non-critical, casting at the DVec3 boundary; key draw commands store f64.

Builds clean (no warnings). Visual verification of crosshair/snap/grip at
extreme UTM zoom pending.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-24 03:51:50 +03:00
1 parent 3da71698b1
commit 4f7a98a2ad
84 files changed
+358 -336

No files matched your search

+11 -11
View File
@@ -18,7 +18,7 @@ use acadrust::entities::{
Spline as SplineEnt,
};
use acadrust::{EntityType, Handle};
use glam::Vec3;
use glam::{DVec3, Vec3};
use crate::command::{CadCommand, CmdResult};
use crate::modules::draw::defaults;
@@ -632,7 +632,7 @@ impl CadCommand for OffsetCommand {
matches!(self.step, Step::SelectObject)
}
fn on_entity_pick(&mut self, handle: Handle, _pt: Vec3) -> CmdResult {
fn on_entity_pick(&mut self, handle: Handle, _pt: DVec3) -> CmdResult {
if handle.is_null() || !matches!(self.step, Step::SelectObject) {
return CmdResult::NeedPoint;
}
@@ -672,10 +672,10 @@ impl CadCommand for OffsetCommand {
}
}
fn dyn_live_value(&self, cursor: Vec3) -> Option<f64> {
fn dyn_live_value(&self, cursor: DVec3) -> Option<f64> {
match &self.step {
Step::PickSide { entity, locked, .. } => {
Some(locked.unwrap_or_else(|| perp_distance(entity, cursor)))
Some(locked.unwrap_or_else(|| perp_distance(entity, cursor.as_vec3())))
}
_ => None,
}
@@ -697,7 +697,7 @@ impl CadCommand for OffsetCommand {
None
}
fn on_hover_entity(&mut self, handle: Handle, _pt: Vec3) -> Vec<WireModel> {
fn on_hover_entity(&mut self, handle: Handle, _pt: DVec3) -> Vec<WireModel> {
if handle.is_null() {
return vec![];
}
@@ -719,33 +719,33 @@ impl CadCommand for OffsetCommand {
vec![]
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
fn on_point(&mut self, pt: DVec3) -> CmdResult {
let (locked, entity) = match &self.step {
Step::PickSide { locked, entity, .. } => (*locked, entity.clone()),
_ => return CmdResult::NeedPoint,
};
let mag = locked.unwrap_or_else(|| perp_distance(&entity, pt));
let mag = locked.unwrap_or_else(|| perp_distance(&entity, pt.as_vec3()));
if mag < 1e-9 {
return CmdResult::NeedPoint;
}
match compute_offset(&entity, mag, pt) {
match compute_offset(&entity, mag, pt.as_vec3()) {
Some(new_entity) => CmdResult::CommitAndExit(new_entity),
None => CmdResult::NeedPoint,
}
}
fn on_preview_wires(&mut self, pt: Vec3) -> Vec<WireModel> {
fn on_preview_wires(&mut self, pt: DVec3) -> Vec<WireModel> {
let (locked, entity) = match &self.step {
Step::PickSide { locked, entity, .. } => (*locked, entity.clone()),
_ => return vec![],
};
let mag = locked.unwrap_or_else(|| perp_distance(&entity, pt));
let mag = locked.unwrap_or_else(|| perp_distance(&entity, pt.as_vec3()));
if mag < 1e-9 {
return vec![];
}
if let Some(result) = compute_offset(&entity, mag, pt) {
if let Some(result) = compute_offset(&entity, mag, pt.as_vec3()) {
let pts = entity_wire_pts(&result);
if !pts.is_empty() {
return vec![WireModel::solid(