Panda3D
geometricBoundingVolume.I
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 geometricBoundingVolume.I
10  * @author drose
11  * @date 1999-10-07
12  */
13 
14 /**
15  *
16  */
17 INLINE_MATHUTIL GeometricBoundingVolume::
18 GeometricBoundingVolume() {
19 #ifdef DO_MEMORY_USAGE
20  MemoryUsage::update_type(this, this);
21 #endif
22 }
23 
24 /**
25  * Increases the size of the volume to include the given volume.
26  */
27 INLINE_MATHUTIL bool GeometricBoundingVolume::
29  return BoundingVolume::extend_by(vol);
30 }
31 
32 /**
33  * Increases the size of the volume to include the given point.
34  */
35 INLINE_MATHUTIL bool GeometricBoundingVolume::
36 extend_by(const LPoint3 &point) {
37  return extend_by_point(point);
38 }
39 
40 /**
41  * Resets the volume to enclose only the volumes indicated.
42  */
43 INLINE_MATHUTIL bool GeometricBoundingVolume::
45  const GeometricBoundingVolume **last) {
46  return BoundingVolume::around((const BoundingVolume **)first,
47  (const BoundingVolume **)last);
48 }
49 
50 /**
51  * Resets the volume to enclose only the points indicated.
52  */
53 INLINE_MATHUTIL bool GeometricBoundingVolume::
54 around(const LPoint3 *first, const LPoint3 *last) {
55  _flags = F_empty;
56  if (first != last) {
57  return around_points(first, last);
58  }
59  return true;
60 }
61 
62 
63 /**
64  * Returns the appropriate set of IntersectionFlags to indicate the amount of
65  * intersection with the indicated volume.
66  */
67 INLINE_MATHUTIL int GeometricBoundingVolume::
68 contains(const GeometricBoundingVolume *vol) const {
69  return BoundingVolume::contains(vol);
70 }
71 
72 /**
73  * Returns the appropriate set of IntersectionFlags to indicate the amount of
74  * intersection with the indicated point.
75  */
76 INLINE_MATHUTIL int GeometricBoundingVolume::
77 contains(const LPoint3 &point) const {
78  if (is_empty()) {
79  return IF_no_intersection;
80  }
81 
82  return contains_point(point);
83 }
84 
85 /**
86  * Returns the appropriate set of IntersectionFlags to indicate the amount of
87  * intersection with the indicated line segment.
88  */
89 INLINE_MATHUTIL int GeometricBoundingVolume::
90 contains(const LPoint3 &a, const LPoint3 &b) const {
91  if (is_empty()) {
92  return IF_no_intersection;
93  }
94 
95  return contains_lineseg(a, b);
96 }
int contains(const BoundingVolume *vol) const
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indi...
int contains(const GeometricBoundingVolume *vol) const
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indi...
bool is_empty() const
Any kind of volume might be empty.
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 ...
static void update_type(ReferenceCount *ptr, TypeHandle type)
Associates the indicated type with the given pointer.
Definition: memoryUsage.I:55
bool around(const BoundingVolume **first, const BoundingVolume **last)
Resets the volume to enclose only the volumes indicated.
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.
bool extend_by(const GeometricBoundingVolume *vol)
Increases the size of the volume to include the given volume.