forked from 1b-agent/opencadstudio-upstream
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:
1 parent
3da71698b1
commit
4f7a98a2ad
84 files changed
+358
-336
No files matched your search
@@ -422,7 +422,7 @@ impl OpenCADStudio {
|
||||
if let Some(r) = self.tabs[i]
|
||||
.active_cmd
|
||||
.as_mut()
|
||||
.map(|c| c.on_entity_pick(handle, pt))
|
||||
.map(|c| c.on_entity_pick(handle, pt.as_dvec3()))
|
||||
{
|
||||
let _ = self.apply_cmd_result(r);
|
||||
}
|
||||
@@ -436,7 +436,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
self.last_point = Some(pt);
|
||||
if let Some(r) = self.tabs[i].active_cmd.as_mut().map(|c| c.on_point(pt)) {
|
||||
if let Some(r) = self.tabs[i].active_cmd.as_mut().map(|c| c.on_point(pt.as_dvec3())) {
|
||||
let _ = self.apply_cmd_result(r);
|
||||
}
|
||||
} else if let Some(r) = self.tabs[i]
|
||||
|
||||
+3
-3
@@ -5402,7 +5402,7 @@ impl OpenCADStudio {
|
||||
if selected.len() == 1 {
|
||||
let handle = selected[0].0;
|
||||
let mut cmd = ExtrudeCommand::new(color);
|
||||
cmd.on_entity_pick(handle, glam::Vec3::ZERO);
|
||||
cmd.on_entity_pick(handle, glam::DVec3::ZERO);
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
} else {
|
||||
@@ -5931,7 +5931,7 @@ impl CadCommand for DrawOrderRefCommand {
|
||||
fn on_entity_pick(
|
||||
&mut self,
|
||||
handle: acadrust::Handle,
|
||||
_pt: glam::Vec3,
|
||||
_pt: glam::DVec3,
|
||||
) -> crate::command::CmdResult {
|
||||
if handle.is_null() {
|
||||
return crate::command::CmdResult::NeedPoint;
|
||||
@@ -5941,7 +5941,7 @@ impl CadCommand for DrawOrderRefCommand {
|
||||
crate::command::CmdResult::Relaunch(cmd, std::mem::take(&mut self.to_move))
|
||||
}
|
||||
|
||||
fn on_point(&mut self, _pt: glam::Vec3) -> crate::command::CmdResult {
|
||||
fn on_point(&mut self, _pt: glam::DVec3) -> crate::command::CmdResult {
|
||||
crate::command::CmdResult::NeedPoint
|
||||
}
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ impl crate::command::CadCommand for PluginInteractiveAdapter {
|
||||
crate::plugin::guard("InteractiveCommand::prompt", || self.inner.prompt())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
fn on_point(&mut self, pt: glam::Vec3) -> crate::command::CmdResult {
|
||||
fn on_point(&mut self, pt: glam::DVec3) -> crate::command::CmdResult {
|
||||
crate::plugin::guard("InteractiveCommand::on_point", || {
|
||||
self.inner.on_point([pt.x as f64, pt.y as f64, pt.z as f64])
|
||||
})
|
||||
@@ -250,7 +250,7 @@ impl crate::command::CadCommand for PluginInteractiveAdapter {
|
||||
})
|
||||
.unwrap_or(false)
|
||||
}
|
||||
fn on_entity_pick(&mut self, handle: Handle, pt: glam::Vec3) -> crate::command::CmdResult {
|
||||
fn on_entity_pick(&mut self, handle: Handle, pt: glam::DVec3) -> crate::command::CmdResult {
|
||||
crate::plugin::guard("InteractiveCommand::on_object_pick", || {
|
||||
self.inner
|
||||
.on_object_pick(handle, [pt.x as f64, pt.y as f64, pt.z as f64])
|
||||
|
||||
+1
-1
@@ -270,7 +270,7 @@ impl OpenCADStudio {
|
||||
// A command may drive a typed scalar by mouse (e.g. a
|
||||
// perpendicular distance to a picked object); show that live
|
||||
// value in the box until the user types over it.
|
||||
let live = tab.active_cmd.as_ref().and_then(|c| c.dyn_live_value(w));
|
||||
let live = tab.active_cmd.as_ref().and_then(|c| c.dyn_live_value(w.as_dvec3()));
|
||||
let boxes: Vec<overlay::DynBox> = tab
|
||||
.dyn_fields
|
||||
.iter()
|
||||
|
||||
Reference in new issue
Block a user