fix: world_offset precision fix for large-coordinate DXF files (e.g. Turkish UTM)

Subtracts the DXF header extents centroid (world_offset) from all coordinates
in f64 BEFORE casting to f32. This eliminates the ~0.5 m ULP error that occurs
at 4,000,000 m UTM coordinates and caused geometry to disappear on zoom-out.

- Scene: adds world_offset field + compute_and_set_world_offset() method
- tessellate.rs: threads world_offset through all f64→f32 conversions
  (legacy_geometry, dimension_geometry, solid_wire_fallback, multileader)
- truck_tess.rs: to_local() helper already in place from prior session
- mod.rs: tessellate_entity() and entity_aabb() apply world_offset
- update.rs: compute_and_set_world_offset() called after doc load
- cmd_result.rs / solid3d_cmds.rs: pass correct offset to truck tessellators

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-04-27 07:41:38 +03:00
commit a2fb334966
7 changed files with 200 additions and 112 deletions

View file

@ -119,8 +119,7 @@ impl WireGpu {
}
/// Creates a ghost copy with `alpha` applied on top of the wire's own alpha.
/// Used for the X-ray pass: selected wires rendered at reduced opacity through
/// occluding geometry.
#[allow(dead_code)]
pub fn new_ghost(device: &wgpu::Device, wire: &WireModel, alpha: f32) -> Self {
let [r, g, b, a] = wire.color;
Self::build(device, wire, [r, g, b, a * alpha])