Panda3D
boundingPlane.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file boundingPlane.h
10  * @author drose
11  * @date 2005-08-19
12  */
13 
14 #ifndef BOUNDINGPLANE_H
15 #define BOUNDINGPLANE_H
16 
17 #include "pandabase.h"
18 
20 #include "plane.h"
21 
22 /**
23  * This funny bounding volume is an infinite plane that divides space into two
24  * regions: the part behind the normal, which is "inside" the bounding volume,
25  * and the part in front of the normal, which is "outside" the bounding
26  * volume.
27  */
28 class EXPCL_PANDA_MATHUTIL BoundingPlane : public GeometricBoundingVolume {
29 PUBLISHED:
30  INLINE_MATHUTIL BoundingPlane();
31  INLINE_MATHUTIL BoundingPlane(const LPlane &plane);
32  ALLOC_DELETED_CHAIN(BoundingPlane);
33 
34 public:
35  virtual BoundingVolume *make_copy() const;
36 
37  virtual LPoint3 get_approx_center() const;
38  virtual void xform(const LMatrix4 &mat);
39 
40  virtual void output(std::ostream &out) const;
41 
42 PUBLISHED:
43  INLINE_MATHUTIL const LPlane &get_plane() const;
44 
45  MAKE_PROPERTY(plane, get_plane);
46 
47 public:
48  virtual const BoundingPlane *as_bounding_plane() const;
49 
50 protected:
51  virtual bool extend_other(BoundingVolume *other) const;
52  virtual bool around_other(BoundingVolume *other,
53  const BoundingVolume **first,
54  const BoundingVolume **last) const;
55  virtual int contains_other(const BoundingVolume *other) const;
56 
57  virtual bool extend_by_plane(const BoundingPlane *plane);
58 
59  virtual int contains_sphere(const BoundingSphere *sphere) const;
60  virtual int contains_box(const BoundingBox *box) const;
61  virtual int contains_line(const BoundingLine *line) const;
62  virtual int contains_plane(const BoundingPlane *plane) const;
63  virtual int contains_hexahedron(const BoundingHexahedron *hexahedron) const;
64 
65 private:
66  LPlane _plane;
67 
68 public:
69  static TypeHandle get_class_type() {
70  return _type_handle;
71  }
72  static void init_type() {
73  GeometricBoundingVolume::init_type();
74  register_type(_type_handle, "BoundingPlane",
75  GeometricBoundingVolume::get_class_type());
76  }
77  virtual TypeHandle get_type() const {
78  return get_class_type();
79  }
80  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
81 
82 private:
83  static TypeHandle _type_handle;
84 
85  friend class BoundingSphere;
86  friend class BoundingBox;
87  friend class BoundingHexahedron;
88 };
89 
90 #include "boundingPlane.I"
91 
92 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An axis-aligned bounding box; that is, a minimum and maximum coordinate triple.
Definition: boundingBox.h:29
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:29
This funny bounding volume is an infinite plane that divides space into two regions: the part behind ...
Definition: boundingPlane.h:28
This defines a bounding sphere, consisting of a center and a radius.
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
virtual const BoundingPlane * as_bounding_plane() const
Virtual downcast method.
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22