Browse Source

half plane aabb

master
gjj 5 months ago
parent
commit
0b12ed88ea
  1. 10
      algoim/organizer/primitive.hpp

10
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(1, 0, 0)) = halfPlaneDesc.normal(0);
tensor.m(uvector3(0, 1, 0)) = halfPlaneDesc.normal(1); tensor.m(uvector3(0, 1, 0)) = halfPlaneDesc.normal(1);
tensor.m(uvector3(0, 0, 1)) = halfPlaneDesc.normal(2); tensor.m(uvector3(0, 0, 1)) = halfPlaneDesc.normal(2);
// AABB
visiblePrimitive.aabb.min = -std::numeric_limits<real>::max();
visiblePrimitive.aabb.max = std::numeric_limits<real>::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 // subBlobTree
visiblePrimitive.subBlobTree.clear(); visiblePrimitive.subBlobTree.clear();
buildNearBalancedBlobTree(visiblePrimitive.subBlobTree, 1); buildNearBalancedBlobTree(visiblePrimitive.subBlobTree, 1);

Loading…
Cancel
Save