refactor(snap): producers emit f64 snap points (world_offset removal P3)

TruckEntity.snap_pts is now DVec3 and every entity producer builds snap
candidates straight from the acadrust f64 coordinates instead of casting
to f32 first (text, mtext, arc, circle, ellipse, point, shape, solid,
mline, mtext, attribute, tolerance, table, underlay, ole2frame, mesh,
multileader, dimension, block-cache). offset_snap_pts stays f64
throughout. Still offset-relative (inert) — but snap precision is no
longer capped at ~0.5 m by an early f32 cast, which fixes a latent
UTM-scale snap error and sets up the absolute-coordinate switch.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.7 committed 2026-06-23 22:10:29 +03:00
1 parent a7a1fac09a
commit cd1d3bb619
18 files changed
+43 -85

No files matched your search

+1 -2
View File
@@ -1,7 +1,6 @@
// acadrust -> truck topology conversion layer.
use acadrust::{CadDocument, EntityType};
use glam::Vec3;
use truck_modeling::{Edge, Solid, Vertex, Wire};
use crate::entities::traits::EntityTypeOps;
@@ -40,7 +39,7 @@ pub enum TruckObject {
pub struct TruckEntity {
pub object: TruckObject,
pub snap_pts: Vec<(Vec3, SnapHint)>,
pub snap_pts: Vec<(glam::DVec3, SnapHint)>,
pub tangent_geoms: Vec<TangentGeom>,
/// Polyline vertex positions in WCS f64; converted to offset-relative f32
/// at the wire-model boundary.
+2 -7
View File
@@ -863,17 +863,12 @@ pub(crate) fn add_polyline(points: &mut Vec<[f32; 3]>, polyline: &[Vec3]) {
}
pub(crate) fn offset_snap_pts(
pts: Vec<(Vec3, SnapHint)>,
pts: Vec<(glam::DVec3, SnapHint)>,
off: [f64; 3],
) -> Vec<(glam::DVec3, SnapHint)> {
let [ox, oy, oz] = off;
pts.into_iter()
.map(|(p, h)| {
(
glam::DVec3::new(p.x as f64 - ox, p.y as f64 - oy, p.z as f64 - oz),
h,
)
})
.map(|(p, h)| (glam::DVec3::new(p.x - ox, p.y - oy, p.z - oz), h))
.collect()
}