00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef BOUNDINGLINE_H
00016 #define BOUNDINGLINE_H
00017
00018 #include "pandabase.h"
00019
00020 #include "geometricBoundingVolume.h"
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 class EXPCL_PANDA_MATHUTIL BoundingLine : public GeometricBoundingVolume {
00034 public:
00035 INLINE_MATHUTIL BoundingLine();
00036
00037 PUBLISHED:
00038 INLINE_MATHUTIL BoundingLine(const LPoint3 &a, const LPoint3 &b);
00039 ALLOC_DELETED_CHAIN(BoundingLine);
00040
00041 public:
00042 virtual BoundingVolume *make_copy() const;
00043
00044 virtual LPoint3 get_approx_center() const;
00045 virtual void xform(const LMatrix4 &mat);
00046
00047 virtual void output(ostream &out) const;
00048
00049 PUBLISHED:
00050 INLINE_MATHUTIL const LPoint3 &get_point_a() const;
00051 INLINE_MATHUTIL LPoint3 get_point_b() const;
00052
00053 public:
00054 virtual const BoundingLine *as_bounding_line() const;
00055
00056 protected:
00057 virtual bool extend_other(BoundingVolume *other) const;
00058 virtual bool around_other(BoundingVolume *other,
00059 const BoundingVolume **first,
00060 const BoundingVolume **last) const;
00061 virtual int contains_other(const BoundingVolume *other) const;
00062
00063 virtual bool extend_by_line(const BoundingLine *line);
00064
00065 virtual int contains_sphere(const BoundingSphere *sphere) const;
00066 virtual int contains_box(const BoundingBox *box) const;
00067
00068 PN_stdfloat sqr_dist_to_line(const LPoint3 &point) const;
00069
00070 private:
00071 LPoint3 _origin;
00072 LVector3 _vector;
00073
00074
00075 public:
00076 static TypeHandle get_class_type() {
00077 return _type_handle;
00078 }
00079 static void init_type() {
00080 GeometricBoundingVolume::init_type();
00081 register_type(_type_handle, "BoundingLine",
00082 GeometricBoundingVolume::get_class_type());
00083 }
00084 virtual TypeHandle get_type() const {
00085 return get_class_type();
00086 }
00087 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00088
00089 private:
00090 static TypeHandle _type_handle;
00091
00092 friend class BoundingSphere;
00093 friend class BoundingBox;
00094 };
00095
00096 #include "boundingLine.I"
00097
00098 #endif