00001 // Filename: omniBoundingVolume.h 00002 // Created by: drose (22Jun00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef OMNIBOUNDINGVOLUME_H 00016 #define OMNIBOUNDINGVOLUME_H 00017 00018 #include "pandabase.h" 00019 00020 #include "geometricBoundingVolume.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : OmniBoundingVolume 00024 // Description : This is a special kind of GeometricBoundingVolume 00025 // that fills all of space. 00026 //////////////////////////////////////////////////////////////////// 00027 class EXPCL_PANDA_MATHUTIL OmniBoundingVolume : public GeometricBoundingVolume { 00028 PUBLISHED: 00029 INLINE_MATHUTIL OmniBoundingVolume(); 00030 00031 public: 00032 virtual BoundingVolume *make_copy() const; 00033 00034 virtual LPoint3 get_approx_center() const; 00035 virtual void xform(const LMatrix4 &mat); 00036 00037 virtual void output(ostream &out) const; 00038 00039 protected: 00040 virtual bool extend_other(BoundingVolume *other) const; 00041 virtual bool around_other(BoundingVolume *other, 00042 const BoundingVolume **first, 00043 const BoundingVolume **last) const; 00044 virtual int contains_other(const BoundingVolume *other) const; 00045 00046 00047 virtual bool extend_by_point(const LPoint3 &point); 00048 virtual bool extend_by_sphere(const BoundingSphere *sphere); 00049 virtual bool extend_by_box(const BoundingBox *box); 00050 virtual bool extend_by_hexahedron(const BoundingHexahedron *hexahedron); 00051 00052 virtual bool around_points(const LPoint3 *first, 00053 const LPoint3 *last); 00054 virtual bool around_spheres(const BoundingVolume **first, 00055 const BoundingVolume **last); 00056 virtual bool around_boxes(const BoundingVolume **first, 00057 const BoundingVolume **last); 00058 virtual bool around_hexahedrons(const BoundingVolume **first, 00059 const BoundingVolume **last); 00060 00061 virtual int contains_point(const LPoint3 &point) const; 00062 virtual int contains_lineseg(const LPoint3 &a, const LPoint3 &b) const; 00063 virtual int contains_hexahedron(const BoundingHexahedron *hexahedron) const; 00064 virtual int contains_sphere(const BoundingSphere *sphere) const; 00065 virtual int contains_box(const BoundingBox *box) const; 00066 00067 public: 00068 static TypeHandle get_class_type() { 00069 return _type_handle; 00070 } 00071 static void init_type() { 00072 GeometricBoundingVolume::init_type(); 00073 register_type(_type_handle, "OmniBoundingVolume", 00074 GeometricBoundingVolume::get_class_type()); 00075 } 00076 virtual TypeHandle get_type() const { 00077 return get_class_type(); 00078 } 00079 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00080 00081 private: 00082 static TypeHandle _type_handle; 00083 00084 friend class BoundingHexahedron; 00085 }; 00086 00087 #include "omniBoundingVolume.I" 00088 00089 #endif