Panda3D
Loading...
Searching...
No Matches
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 */
17INLINE_MATHUTIL GeometricBoundingVolume::
18GeometricBoundingVolume() {
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 */
27INLINE_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 */
35INLINE_MATHUTIL bool GeometricBoundingVolume::
36extend_by(const LPoint3 &point) {
37 return extend_by_point(point);
38}
39
40/**
41 * Resets the volume to enclose only the volumes indicated.
42 */
43INLINE_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 */
53INLINE_MATHUTIL bool GeometricBoundingVolume::
54around(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 */
67INLINE_MATHUTIL int GeometricBoundingVolume::
68contains(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 */
76INLINE_MATHUTIL int GeometricBoundingVolume::
77contains(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 */
89INLINE_MATHUTIL int GeometricBoundingVolume::
90contains(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}
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
bool extend_by(const BoundingVolume *vol)
Increases the size of the volume to include the given volume.
bool is_empty() const
Any kind of volume might be empty.
int contains(const BoundingVolume *vol) const
Returns the appropriate set of IntersectionFlags to indicate the amount of intersection with the indi...
bool around(const BoundingVolume **first, const BoundingVolume **last)
Resets the volume to enclose only the volumes indicated.
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
int contains(const GeometricBoundingVolume *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.
bool around(const GeometricBoundingVolume **first, const GeometricBoundingVolume **last)
Resets the volume to enclose only the volumes indicated.
static void update_type(ReferenceCount *ptr, TypeHandle type)
Associates the indicated type with the given pointer.
Definition memoryUsage.I:55