Panda3D
 All Classes Functions Variables Enumerations
boundingLine.h
1 // Filename: boundingLine.h
2 // Created by: drose (04Jul00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef BOUNDINGLINE_H
16 #define BOUNDINGLINE_H
17 
18 #include "pandabase.h"
19 
20 #include "geometricBoundingVolume.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : BoundingLine
24 // Description : This funny bounding volume is an infinite line with
25 // no thickness and extending to infinity in both
26 // directions.
27 //
28 // Note that it *always* extends in both directions,
29 // despite the fact that you specify two points to the
30 // constructor. These are not endpoints, they are two
31 // arbitrary points on the line.
32 ////////////////////////////////////////////////////////////////////
33 class EXPCL_PANDA_MATHUTIL BoundingLine : public GeometricBoundingVolume {
34 public:
35  INLINE_MATHUTIL BoundingLine();
36 
37 PUBLISHED:
38  INLINE_MATHUTIL BoundingLine(const LPoint3 &a, const LPoint3 &b);
39  ALLOC_DELETED_CHAIN(BoundingLine);
40 
41 public:
42  virtual BoundingVolume *make_copy() const;
43 
44  virtual LPoint3 get_approx_center() const;
45  virtual void xform(const LMatrix4 &mat);
46 
47  virtual void output(ostream &out) const;
48 
49 PUBLISHED:
50  INLINE_MATHUTIL const LPoint3 &get_point_a() const;
51  INLINE_MATHUTIL LPoint3 get_point_b() const;
52 
53 public:
54  virtual const BoundingLine *as_bounding_line() const;
55 
56 protected:
57  virtual bool extend_other(BoundingVolume *other) const;
58  virtual bool around_other(BoundingVolume *other,
59  const BoundingVolume **first,
60  const BoundingVolume **last) const;
61  virtual int contains_other(const BoundingVolume *other) const;
62 
63  virtual bool extend_by_line(const BoundingLine *line);
64 
65  virtual int contains_sphere(const BoundingSphere *sphere) const;
66  virtual int contains_box(const BoundingBox *box) const;
67 
68  PN_stdfloat sqr_dist_to_line(const LPoint3 &point) const;
69 
70 private:
71  LPoint3 _origin;
72  LVector3 _vector;
73 
74 
75 public:
76  static TypeHandle get_class_type() {
77  return _type_handle;
78  }
79  static void init_type() {
80  GeometricBoundingVolume::init_type();
81  register_type(_type_handle, "BoundingLine",
82  GeometricBoundingVolume::get_class_type());
83  }
84  virtual TypeHandle get_type() const {
85  return get_class_type();
86  }
87  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
88 
89 private:
90  static TypeHandle _type_handle;
91 
92  friend class BoundingSphere;
93  friend class BoundingBox;
94 };
95 
96 #include "boundingLine.I"
97 
98 #endif
An axis-aligned bounding box; that is, a minimum and maximum coordinate triple.
Definition: boundingBox.h:31
This defines a bounding sphere, consisting of a center and a radius.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:451
virtual const BoundingLine * as_bounding_line() const
Virtual downcast method.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
This funny bounding volume is an infinite line with no thickness and extending to infinity in both di...
Definition: boundingLine.h:33