diff --git a/algoim/organizer/primitive.hpp b/algoim/organizer/primitive.hpp index 896163f..0ebea9f 100644 --- a/algoim/organizer/primitive.hpp +++ b/algoim/organizer/primitive.hpp @@ -786,6 +786,16 @@ void makeHalfPlane(const HalfPlaneDesc& halfPlaneDesc, VisiblePrimitiveRep& visi tensor.m(uvector3(1, 0, 0)) = halfPlaneDesc.normal(0); tensor.m(uvector3(0, 1, 0)) = halfPlaneDesc.normal(1); tensor.m(uvector3(0, 0, 1)) = halfPlaneDesc.normal(2); + // AABB + visiblePrimitive.aabb.min = -std::numeric_limits::max(); + visiblePrimitive.aabb.max = std::numeric_limits::max(); + for (int dim = 0; dim < 3; ++dim) { + if (halfPlaneDesc.normal(dim) == 1) { + visiblePrimitive.aabb.max(dim) = halfPlaneDesc.basePt(dim); + } else if (halfPlaneDesc.normal(dim) == -1) { + visiblePrimitive.aabb.min(dim) = halfPlaneDesc.basePt(dim); + } + } // subBlobTree visiblePrimitive.subBlobTree.clear(); buildNearBalancedBlobTree(visiblePrimitive.subBlobTree, 1);