forked from 1b-agent/opencadstudio-upstream
fix(block_cache): drop zero-bbox placeholders from defn LO scan
`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 <[email protected]>
This commit is contained in:
1 parent
0d543e8c88
commit
f713354de1
1 file changed
+13
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user