Panda3D
|
00001 // Filename: boundingPlane.h 00002 // Created by: drose (19Aug05) 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 BOUNDINGPLANE_H 00016 #define BOUNDINGPLANE_H 00017 00018 #include "pandabase.h" 00019 00020 #include "geometricBoundingVolume.h" 00021 #include "plane.h" 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Class : BoundingPlane 00025 // Description : This funny bounding volume is an infinite plane that 00026 // divides space into two regions: the part behind the 00027 // normal, which is "inside" the bounding volume, and 00028 // the part in front of the normal, which is "outside" 00029 // the bounding volume. 00030 //////////////////////////////////////////////////////////////////// 00031 class EXPCL_PANDA_MATHUTIL BoundingPlane : public GeometricBoundingVolume { 00032 PUBLISHED: 00033 INLINE_MATHUTIL BoundingPlane(); 00034 INLINE_MATHUTIL BoundingPlane(const LPlane &plane); 00035 ALLOC_DELETED_CHAIN(BoundingPlane); 00036 00037 public: 00038 virtual BoundingVolume *make_copy() const; 00039 00040 virtual LPoint3 get_approx_center() const; 00041 virtual void xform(const LMatrix4 &mat); 00042 00043 virtual void output(ostream &out) const; 00044 00045 PUBLISHED: 00046 INLINE_MATHUTIL const LPlane &get_plane() const; 00047 00048 public: 00049 virtual const BoundingPlane *as_bounding_plane() const; 00050 00051 protected: 00052 virtual bool extend_other(BoundingVolume *other) const; 00053 virtual bool around_other(BoundingVolume *other, 00054 const BoundingVolume **first, 00055 const BoundingVolume **last) const; 00056 virtual int contains_other(const BoundingVolume *other) const; 00057 00058 virtual bool extend_by_plane(const BoundingPlane *plane); 00059 00060 virtual int contains_sphere(const BoundingSphere *sphere) const; 00061 virtual int contains_box(const BoundingBox *box) const; 00062 virtual int contains_line(const BoundingLine *line) const; 00063 virtual int contains_plane(const BoundingPlane *plane) const; 00064 virtual int contains_hexahedron(const BoundingHexahedron *hexahedron) const; 00065 00066 private: 00067 LPlane _plane; 00068 00069 public: 00070 static TypeHandle get_class_type() { 00071 return _type_handle; 00072 } 00073 static void init_type() { 00074 GeometricBoundingVolume::init_type(); 00075 register_type(_type_handle, "BoundingPlane", 00076 GeometricBoundingVolume::get_class_type()); 00077 } 00078 virtual TypeHandle get_type() const { 00079 return get_class_type(); 00080 } 00081 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00082 00083 private: 00084 static TypeHandle _type_handle; 00085 00086 friend class BoundingSphere; 00087 friend class BoundingBox; 00088 }; 00089 00090 #include "boundingPlane.I" 00091 00092 #endif