Panda3D
 All Classes Functions Variables Enumerations
geometricBoundingVolume.I
1 // Filename: geometricBoundingVolume.I
2 // Created by: drose (07Oct99)
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 ////////////////////////////////////////////////////////////////////
16 // Function: GeometricBoundingVolume::Constructor
17 // Access: Public
18 // Description:
19 ////////////////////////////////////////////////////////////////////
20 INLINE_MATHUTIL GeometricBoundingVolume::
21 GeometricBoundingVolume() {
22 }
23 
24 ////////////////////////////////////////////////////////////////////
25 // Function: GeometricBoundingVolume::extend_by
26 // Access: Public
27 // Description: Increases the size of the volume to include the given
28 // volume.
29 ////////////////////////////////////////////////////////////////////
30 INLINE_MATHUTIL bool GeometricBoundingVolume::
32  return BoundingVolume::extend_by(vol);
33 }
34 
35 ////////////////////////////////////////////////////////////////////
36 // Function: GeometricBoundingVolume::extend_by
37 // Access: Public
38 // Description: Increases the size of the volume to include the given
39 // point.
40 ////////////////////////////////////////////////////////////////////
41 INLINE_MATHUTIL bool GeometricBoundingVolume::
42 extend_by(const LPoint3 &point) {
43  return extend_by_point(point);
44 }
45 
46 ////////////////////////////////////////////////////////////////////
47 // Function: GeometricBoundingVolume::around
48 // Access: Public
49 // Description: Resets the volume to enclose only the volumes
50 // indicated.
51 ////////////////////////////////////////////////////////////////////
52 INLINE_MATHUTIL bool GeometricBoundingVolume::
54  const GeometricBoundingVolume **last) {
55  return BoundingVolume::around((const BoundingVolume **)first,
56  (const BoundingVolume **)last);
57 }
58 
59 ////////////////////////////////////////////////////////////////////
60 // Function: GeometricBoundingVolume::around
61 // Access: Public
62 // Description: Resets the volume to enclose only the points
63 // indicated.
64 ////////////////////////////////////////////////////////////////////
65 INLINE_MATHUTIL bool GeometricBoundingVolume::
66 around(const LPoint3 *first, const LPoint3 *last) {
67  _flags = F_empty;
68  if (first != last) {
69  return around_points(first, last);
70  }
71  return true;
72 }
73 
74 
75 ////////////////////////////////////////////////////////////////////
76 // Function: GeometricBoundingVolume::contains
77 // Access: Public
78 // Description: Returns the appropriate set of IntersectionFlags to
79 // indicate the amount of intersection with the
80 // indicated volume.
81 ////////////////////////////////////////////////////////////////////
82 INLINE_MATHUTIL int GeometricBoundingVolume::
83 contains(const GeometricBoundingVolume *vol) const {
84  return BoundingVolume::contains(vol);
85 }
86 
87 ////////////////////////////////////////////////////////////////////
88 // Function: GeometricBoundingVolume::contains
89 // Access: Public
90 // Description: Returns the appropriate set of IntersectionFlags to
91 // indicate the amount of intersection with the
92 // indicated point.
93 ////////////////////////////////////////////////////////////////////
94 INLINE_MATHUTIL int GeometricBoundingVolume::
95 contains(const LPoint3 &point) const {
96  if (is_empty()) {
97  return IF_no_intersection;
98  }
99 
100  return contains_point(point);
101 }
102 
103 ////////////////////////////////////////////////////////////////////
104 // Function: GeometricBoundingVolume::contains
105 // Access: Public
106 // Description: Returns the appropriate set of IntersectionFlags to
107 // indicate the amount of intersection with the
108 // indicated line segment.
109 ////////////////////////////////////////////////////////////////////
110 INLINE_MATHUTIL int GeometricBoundingVolume::
111 contains(const LPoint3 &a, const LPoint3 &b) const {
112  if (is_empty()) {
113  return IF_no_intersection;
114  }
115 
116  return contains_lineseg(a, b);
117 }
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
int contains(const GeometricBoundingVolume *vol) const
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indi...
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 ...
bool around(const BoundingVolume **first, const BoundingVolume **last)
Resets the volume to enclose only the volumes indicated.
bool is_empty() const
Any kind of volume might be empty.
bool extend_by(const BoundingVolume *vol)
Increases the size of the volume to include the given volume.
bool around(const GeometricBoundingVolume **first, const GeometricBoundingVolume **last)
Resets the volume to enclose only the volumes indicated.
int contains(const BoundingVolume *vol) const
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indi...
bool extend_by(const GeometricBoundingVolume *vol)
Increases the size of the volume to include the given volume.