refactor(snap): widen snap_pts to f64 (world_offset removal P2)

WireModel/LocalWire/TruckEntity snap buffers and the producers/consumers
now carry snap candidates as DVec3 (offset_snap_pts, dimension/multileader
producers, block-cache transform, pick/xclip, snap module). Still
offset-relative, so behaviour is unchanged — this just lets the snap
transport survive the upcoming switch to absolute coordinates without an
extra f32 quantization. The snap module still resolves in f32 (as_vec3 at
entry), matching today's precision.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.7 committed 2026-06-23 18:52:42 +03:00
1 parent ab7cd63dec
commit a7a1fac09a
8 files changed
+30 -26

No files matched your search

+10 -3
View File
@@ -477,7 +477,7 @@ pub fn tessellate(
// Add insertion snap at point_of_reference.
let [ox, oy, oz] = world_offset;
if let Some(p) = crate::entities::solid3d::point_of_reference(entity) {
let sp = Vec3::new((p.x - ox) as f32, (p.y - oy) as f32, (p.z - oz) as f32);
let sp = glam::DVec3::new(p.x - ox, p.y - oy, p.z - oz);
wm.snap_pts.push((sp, SnapHint::Insertion));
}
return vec![wm];
@@ -487,6 +487,10 @@ pub fn tessellate(
// ── Fallback for Viewport / Insert / Hatch / Ole2Frame ────────────────
let (points, snap_pts, tangent_geoms, key_vertices) = fallback_geometry(entity, world_offset);
// fallback_geometry still emits offset-relative f32 snap points; widen to
// f64 for the WireModel's double-single-era snap buffer.
let snap_pts: Vec<(glam::DVec3, SnapHint)> =
snap_pts.into_iter().map(|(p, h)| (p.as_dvec3(), h)).collect();
vec![WireModel {
name,
points,
@@ -858,12 +862,15 @@ pub(crate) fn add_polyline(points: &mut Vec<[f32; 3]>, polyline: &[Vec3]) {
points.extend(polyline.iter().map(|p| [p.x, p.y, p.z]));
}
pub(crate) fn offset_snap_pts(pts: Vec<(Vec3, SnapHint)>, off: [f64; 3]) -> Vec<(Vec3, SnapHint)> {
pub(crate) fn offset_snap_pts(
pts: Vec<(Vec3, SnapHint)>,
off: [f64; 3],
) -> Vec<(glam::DVec3, SnapHint)> {
let [ox, oy, oz] = off;
pts.into_iter()
.map(|(p, h)| {
(
Vec3::new(p.x - ox as f32, p.y - oy as f32, p.z - oz as f32),
glam::DVec3::new(p.x as f64 - ox, p.y as f64 - oy, p.z as f64 - oz),
h,
)
})