Panda3D
 All Classes Functions Variables Enumerations
boundingPlane.h
1 // Filename: boundingPlane.h
2 // Created by: drose (19Aug05)
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 BOUNDINGPLANE_H
16 #define BOUNDINGPLANE_H
17 
18 #include "pandabase.h"
19 
20 #include "geometricBoundingVolume.h"
21 #include "plane.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : BoundingPlane
25 // Description : This funny bounding volume is an infinite plane that
26 // divides space into two regions: the part behind the
27 // normal, which is "inside" the bounding volume, and
28 // the part in front of the normal, which is "outside"
29 // the bounding volume.
30 ////////////////////////////////////////////////////////////////////
31 class EXPCL_PANDA_MATHUTIL BoundingPlane : public GeometricBoundingVolume {
32 PUBLISHED:
33  INLINE_MATHUTIL BoundingPlane();
34  INLINE_MATHUTIL BoundingPlane(const LPlane &plane);
35  ALLOC_DELETED_CHAIN(BoundingPlane);
36 
37 public:
38  virtual BoundingVolume *make_copy() const;
39 
40  virtual LPoint3 get_approx_center() const;
41  virtual void xform(const LMatrix4 &mat);
42 
43  virtual void output(ostream &out) const;
44 
45 PUBLISHED:
46  INLINE_MATHUTIL const LPlane &get_plane() const;
47 
48 public:
49  virtual const BoundingPlane *as_bounding_plane() const;
50 
51 protected:
52  virtual bool extend_other(BoundingVolume *other) const;
53  virtual bool around_other(BoundingVolume *other,
54  const BoundingVolume **first,
55  const BoundingVolume **last) const;
56  virtual int contains_other(const BoundingVolume *other) const;
57 
58  virtual bool extend_by_plane(const BoundingPlane *plane);
59 
60  virtual int contains_sphere(const BoundingSphere *sphere) const;
61  virtual int contains_box(const BoundingBox *box) const;
62  virtual int contains_line(const BoundingLine *line) const;
63  virtual int contains_plane(const BoundingPlane *plane) const;
64  virtual int contains_hexahedron(const BoundingHexahedron *hexahedron) const;
65 
66 private:
67  LPlane _plane;
68 
69 public:
70  static TypeHandle get_class_type() {
71  return _type_handle;
72  }
73  static void init_type() {
74  GeometricBoundingVolume::init_type();
75  register_type(_type_handle, "BoundingPlane",
76  GeometricBoundingVolume::get_class_type());
77  }
78  virtual TypeHandle get_type() const {
79  return get_class_type();
80  }
81  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
82 
83 private:
84  static TypeHandle _type_handle;
85 
86  friend class BoundingSphere;
87  friend class BoundingBox;
88 };
89 
90 #include "boundingPlane.I"
91 
92 #endif
An axis-aligned bounding box; that is, a minimum and maximum coordinate triple.
Definition: boundingBox.h:31
virtual const BoundingPlane * as_bounding_plane() const
Virtual downcast method.
This defines a bounding sphere, consisting of a center and a radius.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
This funny bounding volume is an infinite plane that divides space into two regions: the part behind ...
Definition: boundingPlane.h:31
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
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
This defines a bounding convex hexahedron.
This funny bounding volume is an infinite line with no thickness and extending to infinity in both di...
Definition: boundingLine.h:33