Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/mathutil/boundingLine.h

Go to the documentation of this file.
00001 // Filename: boundingLine.h
00002 // Created by:  drose (04Jul00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef BOUNDINGLINE_H
00020 #define BOUNDINGLINE_H
00021 
00022 #include <pandabase.h>
00023 
00024 #include "geometricBoundingVolume.h"
00025 
00026 ///////////////////////////////////////////////////////////////////
00027 //       Class : BoundingLine
00028 // Description : This funny bounding volume is an infinite line with
00029 //               no thickness and extending to infinity in both
00030 //               directions.
00031 //
00032 //               Note that it *always* extends in both directions,
00033 //               despite the fact that you specify two points to the
00034 //               constructor.  These are not endpoints, they are two
00035 //               arbitrary points on the line.
00036 ////////////////////////////////////////////////////////////////////
00037 class EXPCL_PANDA BoundingLine : public GeometricBoundingVolume {
00038 PUBLISHED:
00039   INLINE_MATHUTIL BoundingLine();
00040   INLINE_MATHUTIL BoundingLine(const LPoint3f &a, const LPoint3f &b);
00041 
00042 public:
00043   virtual BoundingVolume *make_copy() const;
00044 
00045   virtual LPoint3f get_approx_center() const;
00046   virtual void xform(const LMatrix4f &mat);
00047 
00048   virtual void output(ostream &out) const;
00049 
00050 PUBLISHED:
00051   INLINE_MATHUTIL const LPoint3f &get_point_a() const;
00052   INLINE_MATHUTIL LPoint3f get_point_b() const;
00053 
00054 protected:
00055   virtual bool extend_other(BoundingVolume *other) const;
00056   virtual bool around_other(BoundingVolume *other,
00057                             const BoundingVolume **first,
00058                             const BoundingVolume **last) const;
00059   virtual int contains_other(const BoundingVolume *other) const;
00060 
00061   virtual bool extend_by_line(const BoundingLine *line);
00062 
00063   virtual int contains_sphere(const BoundingSphere *sphere) const;
00064 
00065   float sqr_dist_to_line(const LPoint3f &point) const;
00066 
00067 private:
00068   LPoint3f _origin;
00069   LVector3f _vector;
00070 
00071 
00072 public:
00073   static TypeHandle get_class_type() {
00074     return _type_handle;
00075   }
00076   static void init_type() {
00077     GeometricBoundingVolume::init_type();
00078     register_type(_type_handle, "BoundingLine",
00079                   GeometricBoundingVolume::get_class_type());
00080   }
00081   virtual TypeHandle get_type() const {
00082     return get_class_type();
00083   }
00084   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00085 
00086 private:
00087   static TypeHandle _type_handle;
00088 
00089   friend class BoundingSphere;
00090 };
00091 
00092 #include "boundingLine.I"
00093 
00094 #endif

Generated on Fri May 2 00:40:23 2003 for Panda by doxygen1.3