fix(grips): compute grip positions in f64 so they sit on the wire
Grip markers drew visibly offset from the entity on large-coordinate (UTM-scale) drawings: every Grippable impl cast the f64 entity coordinates to f32 BEFORE the world-offset subtraction, and at 1e7 magnitude an f32 holds ~0.9 drawing units of rounding error. The wires subtract the offset in f64 first (precision-preserving), so the grips landed up to ~1 unit away from the geometry they belong to. GripDef.world is now DVec3: producers fill it straight from the f64 entity data, refresh_selected_grips subtracts the world offset in f64, and only the small offset-local result is cast to f32 for screen-space projection (grips_to_screen / find_hit_grip) and drag state. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ed29933d87
commit
25715d1b03
33 changed files with 898 additions and 817 deletions
|
|
@ -1,5 +1,4 @@
|
|||
use acadrust::entities::{Ray, XLine};
|
||||
use glam::Vec3;
|
||||
|
||||
use crate::command::EntityTransform;
|
||||
use crate::entities::common::{center_grip, edit_prop as edit, square_grip};
|
||||
|
|
@ -47,13 +46,13 @@ impl Grippable for Ray {
|
|||
// Grip 1: a point along the direction (changes direction)
|
||||
let guide_dist = 10.0_f64;
|
||||
vec![
|
||||
square_grip(0, Vec3::new(bp.x as f32, bp.y as f32, bp.z as f32)),
|
||||
square_grip(0, glam::DVec3::new(bp.x, bp.y, bp.z)),
|
||||
center_grip(
|
||||
1,
|
||||
Vec3::new(
|
||||
(bp.x + dir.x * guide_dist) as f32,
|
||||
(bp.y + dir.y * guide_dist) as f32,
|
||||
(bp.z + dir.z * guide_dist) as f32,
|
||||
glam::DVec3::new(
|
||||
bp.x + dir.x * guide_dist,
|
||||
bp.y + dir.y * guide_dist,
|
||||
bp.z + dir.z * guide_dist,
|
||||
),
|
||||
),
|
||||
]
|
||||
|
|
@ -185,13 +184,13 @@ impl Grippable for XLine {
|
|||
let dir = &self.direction;
|
||||
let guide_dist = 10.0_f64;
|
||||
vec![
|
||||
square_grip(0, Vec3::new(bp.x as f32, bp.y as f32, bp.z as f32)),
|
||||
square_grip(0, glam::DVec3::new(bp.x, bp.y, bp.z)),
|
||||
center_grip(
|
||||
1,
|
||||
Vec3::new(
|
||||
(bp.x + dir.x * guide_dist) as f32,
|
||||
(bp.y + dir.y * guide_dist) as f32,
|
||||
(bp.z + dir.z * guide_dist) as f32,
|
||||
glam::DVec3::new(
|
||||
bp.x + dir.x * guide_dist,
|
||||
bp.y + dir.y * guide_dist,
|
||||
bp.z + dir.z * guide_dist,
|
||||
),
|
||||
),
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in a new issue