From f713354de194e5b19c8af7cc4c5613a9414ffdfc Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Fri, 15 May 2026 06:30:52 +0300 Subject: [PATCH] fix(block_cache): drop zero-bbox placeholders from defn LO scan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Entity::bounding_box()` for empty / vertex-less entities (Polyline, LwPolyline, Hatch, etc.) returns `BoundingBox3D::from_point(Vector3::ZERO)` — the (0, 0, 0)→(0, 0, 0) placeholder. Including those in the LO centroid scan dragged it toward the origin even for UTM-authored blocks, defeating the precision-preservation: stored f32 then sat at UTM-minus-near-zero, losing precision before tessellate even returned. Reject the zero placeholder so only real geometry contributes. Co-Authored-By: Claude Opus 4.7 --- src/scene/block_cache.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/scene/block_cache.rs b/src/scene/block_cache.rs index 78cad7f5b..d5f1e427e 100644 --- a/src/scene/block_cache.rs +++ b/src/scene/block_cache.rs @@ -285,6 +285,19 @@ fn build_defn( (bb.min, bb.max) } }; + // Skip the "placeholder ZERO bbox" that empty Polyline / Hatch / + // Spline / Mesh / etc. return when they have no vertices — + // including these would pull the centroid toward origin and ruin + // the precision-preservation for UTM-authored content. + let is_zero_placeholder = bmin.x == 0.0 + && bmin.y == 0.0 + && bmin.z == 0.0 + && bmax.x == 0.0 + && bmax.y == 0.0 + && bmax.z == 0.0; + if is_zero_placeholder { + continue; + } let lo_arr = [bmin.x, bmin.y, bmin.z]; let hi_arr = [bmax.x, bmax.y, bmax.z]; for i in 0..3 {