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 SevenandClaude Sonnet 4.6 committed 2026-04-27 07:41:38 +03:00
1 parent e38638502e
commit a2fb334966
7 files changed
+200 -112

No files matched your search

+2 -2
View File
@@ -25,7 +25,7 @@ use crate::scene::truck_tess;
// ── Tessellation helper ────────────────────────────────────────────────────
fn solid_to_mesh(solid: &truck_modeling::Solid, color: [f32; 4], name: &str) -> Option<MeshModel> {
match truck_tess::tessellate_solid(solid) {
match truck_tess::tessellate_solid(solid, [0.0; 3]) {
truck_tess::TruckTessResult::Mesh { verts, normals, indices } => Some(MeshModel {
name: name.to_string(),
verts, normals, indices,
@@ -37,7 +37,7 @@ fn solid_to_mesh(solid: &truck_modeling::Solid, color: [f32; 4], name: &str) ->
}
fn shell_to_mesh(shell: &truck_modeling::Shell, color: [f32; 4], name: &str) -> Option<MeshModel> {
match truck_tess::tessellate_shell(shell) {
match truck_tess::tessellate_shell(shell, [0.0; 3]) {
truck_tess::TruckTessResult::Mesh { verts, normals, indices } => Some(MeshModel {
name: name.to_string(),
verts, normals, indices,