00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef GEOMETRICBOUNDINGVOLUME_H
00016 #define GEOMETRICBOUNDINGVOLUME_H
00017
00018 #include "pandabase.h"
00019
00020 #include "boundingVolume.h"
00021
00022 #include "luse.h"
00023 #include "lmatrix.h"
00024
00025
00026
00027
00028
00029
00030
00031 class EXPCL_PANDA_MATHUTIL GeometricBoundingVolume : public BoundingVolume {
00032 public:
00033 INLINE_MATHUTIL GeometricBoundingVolume();
00034
00035 PUBLISHED:
00036 INLINE_MATHUTIL bool extend_by(const GeometricBoundingVolume *vol);
00037 INLINE_MATHUTIL bool extend_by(const LPoint3 &point);
00038
00039
00040
00041
00042 INLINE_MATHUTIL bool around(const GeometricBoundingVolume **first,
00043 const GeometricBoundingVolume **last);
00044 INLINE_MATHUTIL bool around(const LPoint3 *first, const LPoint3 *last);
00045
00046 INLINE_MATHUTIL int contains(const GeometricBoundingVolume *vol) const;
00047 INLINE_MATHUTIL int contains(const LPoint3 &point) const;
00048 INLINE_MATHUTIL int contains(const LPoint3 &a, const LPoint3 &b) const;
00049
00050 virtual LPoint3 get_approx_center() const=0;
00051 virtual void xform(const LMatrix4 &mat)=0;
00052
00053 public:
00054 virtual const GeometricBoundingVolume *as_geometric_bounding_volume() const;
00055
00056 protected:
00057
00058
00059
00060 virtual bool extend_by_point(const LPoint3 &point);
00061 virtual bool around_points(const LPoint3 *first,
00062 const LPoint3 *last);
00063 virtual int contains_point(const LPoint3 &point) const;
00064 virtual int contains_lineseg(const LPoint3 &a, const LPoint3 &b) const;
00065
00066
00067 public:
00068 static TypeHandle get_class_type() {
00069 return _type_handle;
00070 }
00071 static void init_type() {
00072 BoundingVolume::init_type();
00073 register_type(_type_handle, "GeometricBoundingVolume",
00074 BoundingVolume::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
00085 #include "geometricBoundingVolume.I"
00086
00087 #endif