45 while (first != last && (*first)->
is_empty()) {
46 if ((*first)->is_infinite()) {
59 for (bvi = first; bvi != last; ++bvi) {
60 if ((*bvi)->is_infinite()) {
69 if (!(*first)->around_other(
this, first, last)) {
81 write(ostream &out,
int indent_level)
const {
82 indent(out, indent_level) << *
this <<
"\n";
162 if (strcmp(str.c_str(),
"default") == 0) {
165 }
else if (strcmp(str.c_str(),
"best") == 0) {
168 }
else if (strcmp(str.c_str(),
"fastest") == 0) {
171 }
else if (strcmp(str.c_str(),
"sphere") == 0) {
174 }
else if (strcmp(str.c_str(),
"box") == 0) {
185 bool BoundingVolume::
187 return extend_by_finite(sphere);
194 bool BoundingVolume::
196 return extend_by_finite(box);
203 bool BoundingVolume::
205 return extend_by_finite(hexahedron);
212 bool BoundingVolume::
214 return extend_by_geometric(line);
221 bool BoundingVolume::
223 return extend_by_geometric(plane);
230 bool BoundingVolume::
232 return extend_by_geometric(unionv);
239 bool BoundingVolume::
241 return extend_by_geometric(intersection);
247 bool BoundingVolume::
249 return extend_by_geometric(volume);
255 bool BoundingVolume::
257 mathutil_cat.warning()
258 << get_type() <<
"::extend_by_geometric() called with " << volume->get_type() <<
"\n";
267 bool BoundingVolume::
269 return around_finite(first, last);
276 bool BoundingVolume::
278 return around_finite(first, last);
285 bool BoundingVolume::
287 return around_finite(first, last);
294 bool BoundingVolume::
296 return around_geometric(first, last);
303 bool BoundingVolume::
305 return around_geometric(first, last);
312 bool BoundingVolume::
314 return around_geometric(first, last);
321 bool BoundingVolume::
323 return around_geometric(first, last);
329 bool BoundingVolume::
331 return around_geometric(first, last);
337 bool BoundingVolume::
339 mathutil_cat.warning()
340 << get_type() <<
"::extend_by_geometric() called with " << first[0]->get_type() <<
"\n";
351 return contains_finite(sphere);
360 return contains_finite(box);
369 return contains_finite(hexahedron);
378 return contains_geometric(line);
387 return contains_geometric(plane);
396 return unionv->other_contains_union(
this);
405 return intersection->other_contains_intersection(
this);
413 return contains_geometric(volume);
421 mathutil_cat.warning()
422 << get_type() <<
"::contains_geometric() called with " << volume->get_type() <<
"\n";
423 return IF_dont_understand;
427 operator << (ostream &out, BoundingVolume::BoundsType type) {
429 case BoundingVolume::BT_default:
430 return out <<
"default";
432 case BoundingVolume::BT_best:
433 return out <<
"best";
435 case BoundingVolume::BT_fastest:
436 return out <<
"fastest";
438 case BoundingVolume::BT_sphere:
439 return out <<
"sphere";
441 case BoundingVolume::BT_box:
446 <<
"Invalid BoundingVolume::BoundsType value: " << (int)type <<
"\n";
447 nassertr(
false, out);
452 operator >> (istream &in, BoundingVolume::BoundsType &type) {
456 if (type == BoundingVolume::BT_default) {
457 mathutil_cat->error()
458 <<
"Invalid BoundingVolume::BoundsType string: " << word <<
"\n";
An axis-aligned bounding box; that is, a minimum and maximum coordinate triple.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual const BoundingLine * as_bounding_line() const
Virtual downcast method.
bool is_empty() const
Any kind of volume might be empty.
This defines a bounding sphere, consisting of a center and a radius.
virtual const BoundingHexahedron * as_bounding_hexahedron() const
Virtual downcast method.
static BoundsType string_bounds_type(const std::string &str)
Returns the BoundsType corresponding to the indicated string.
virtual const BoundingBox * as_bounding_box() const
Virtual downcast method.
This funny bounding volume is an infinite plane that divides space into two regions: the part behind ...
virtual const BoundingPlane * as_bounding_plane() const
Virtual downcast method.
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
virtual const BoundingSphere * as_bounding_sphere() const
Virtual downcast method.
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
virtual const FiniteBoundingVolume * as_finite_bounding_volume() const
Virtual downcast method.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This special bounding volume is the intersection of all of its constituent bounding volumes.
This special bounding volume is the union of all of its constituent bounding volumes.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
A special kind of GeometricBoundingVolume that is known to be finite.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool around(const BoundingVolume **first, const BoundingVolume **last)
Resets the volume to enclose only the volumes indicated.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
virtual GeometricBoundingVolume * as_geometric_bounding_volume()
Virtual downcast method.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This defines a bounding convex hexahedron.
This funny bounding volume is an infinite line with no thickness and extending to infinity in both di...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.