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
|
|
@ -112,18 +112,14 @@ fn to_truck(circle: &Circle) -> TruckEntity {
|
|||
}
|
||||
|
||||
fn grips(circle: &Circle) -> Vec<GripDef> {
|
||||
let ctr = Vec3::new(
|
||||
circle.center.x as f32,
|
||||
circle.center.y as f32,
|
||||
circle.center.z as f32,
|
||||
);
|
||||
let r = circle.radius as f32;
|
||||
let ctr = glam::DVec3::new(circle.center.x, circle.center.y, circle.center.z);
|
||||
let r = circle.radius;
|
||||
vec![
|
||||
center_grip(0, ctr),
|
||||
square_grip(1, ctr + Vec3::new(r, 0.0, 0.0)),
|
||||
square_grip(2, ctr + Vec3::new(0.0, r, 0.0)),
|
||||
square_grip(3, ctr - Vec3::new(r, 0.0, 0.0)),
|
||||
square_grip(4, ctr - Vec3::new(0.0, r, 0.0)),
|
||||
square_grip(1, ctr + glam::DVec3::new(r, 0.0, 0.0)),
|
||||
square_grip(2, ctr + glam::DVec3::new(0.0, r, 0.0)),
|
||||
square_grip(3, ctr - glam::DVec3::new(r, 0.0, 0.0)),
|
||||
square_grip(4, ctr - glam::DVec3::new(0.0, r, 0.0)),
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue