void Polygon3D::getAABB(AABB3D& bb) const { if(vertices.size() == 0) { bb.minimize(); return; } bb.setPoint(vertices[0]); for(size_t i=1; i<vertices.size(); i++) bb.expand(vertices[i]); }
void Circle3D::getAABB(AABB3D& aabb) const { aabb.setPoint(center); Real x,y,z; x = pythag_leg(axis.x,One)*radius; y = pythag_leg(axis.y,One)*radius; z = pythag_leg(axis.z,One)*radius; aabb.bmin.x -= x; aabb.bmin.y -= y; aabb.bmin.z -= z; aabb.bmax.x += x; aabb.bmax.y += y; aabb.bmax.z += z; }
void Triangle3D::getAABB(AABB3D& bb) const { bb.setPoint(a); bb.expand(b); bb.expand(c); }
void Sphere3D::getAABB(AABB3D& bb) const { bb.setPoint(center); bb.bmin.x-=radius; bb.bmin.y-=radius; bb.bmin.z-=radius; bb.bmax.x+=radius; bb.bmax.y+=radius; bb.bmax.z+=radius; }
void ConvexPolyhedron3D::getAABB(AABB3D& b) const { b.setPoint(vertices[0]); for(int i=1; i<numVertices; i++) b.expand(vertices[i]); }
void Segment3D::getAABB(AABB3D& bb) const { bb.setPoint(a); bb.expand(b); }