Panda3D
omniBoundingVolume.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 omniBoundingVolume.h
10  * @author drose
11  * @date 2000-06-22
12  */
13 
14 #ifndef OMNIBOUNDINGVOLUME_H
15 #define OMNIBOUNDINGVOLUME_H
16 
17 #include "pandabase.h"
18 
20 
21 /**
22  * This is a special kind of GeometricBoundingVolume that fills all of space.
23  */
24 class EXPCL_PANDA_MATHUTIL OmniBoundingVolume : public GeometricBoundingVolume {
25 PUBLISHED:
26  INLINE_MATHUTIL OmniBoundingVolume();
27 
28 public:
29  virtual BoundingVolume *make_copy() const;
30 
31  virtual LPoint3 get_approx_center() const;
32  virtual void xform(const LMatrix4 &mat);
33 
34  virtual void output(std::ostream &out) const;
35 
36 protected:
37  virtual bool extend_other(BoundingVolume *other) const;
38  virtual bool around_other(BoundingVolume *other,
39  const BoundingVolume **first,
40  const BoundingVolume **last) const;
41  virtual int contains_other(const BoundingVolume *other) const;
42 
43 
44  virtual bool extend_by_point(const LPoint3 &point);
45  virtual bool extend_by_sphere(const BoundingSphere *sphere);
46  virtual bool extend_by_box(const BoundingBox *box);
47  virtual bool extend_by_hexahedron(const BoundingHexahedron *hexahedron);
48 
49  virtual bool around_points(const LPoint3 *first,
50  const LPoint3 *last);
51  virtual bool around_spheres(const BoundingVolume **first,
52  const BoundingVolume **last);
53  virtual bool around_boxes(const BoundingVolume **first,
54  const BoundingVolume **last);
55  virtual bool around_hexahedrons(const BoundingVolume **first,
56  const BoundingVolume **last);
57 
58  virtual int contains_point(const LPoint3 &point) const;
59  virtual int contains_lineseg(const LPoint3 &a, const LPoint3 &b) const;
60  virtual int contains_hexahedron(const BoundingHexahedron *hexahedron) const;
61  virtual int contains_sphere(const BoundingSphere *sphere) const;
62  virtual int contains_box(const BoundingBox *box) const;
63 
64 public:
65  static TypeHandle get_class_type() {
66  return _type_handle;
67  }
68  static void init_type() {
69  GeometricBoundingVolume::init_type();
70  register_type(_type_handle, "OmniBoundingVolume",
71  GeometricBoundingVolume::get_class_type());
72  }
73  virtual TypeHandle get_type() const {
74  return get_class_type();
75  }
76  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
77 
78 private:
79  static TypeHandle _type_handle;
80 
81  friend class BoundingHexahedron;
82 };
83 
84 #include "omniBoundingVolume.I"
85 
86 #endif
An axis-aligned bounding box; that is, a minimum and maximum coordinate triple.
Definition: boundingBox.h:29
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This defines a bounding sphere, consisting of a center and a radius.
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a special kind of GeometricBoundingVolume that fills all of space.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
This defines a bounding convex hexahedron.