Panda3D
Loading...
Searching...
No Matches
finiteBoundingVolume.cxx
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 finiteBoundingVolume.cxx
10 * @author drose
11 * @date 1999-10-02
12 */
13
15#include "boundingBox.h"
16#include "config_mathutil.h"
17
18TypeHandle FiniteBoundingVolume::_type_handle;
19
20/**
21 *
22 */
23PN_stdfloat FiniteBoundingVolume::
24get_volume() const {
25 nassertr(!is_infinite(), 0.0f);
26 if (is_empty()) {
27 return 0.0f;
28 }
29
30 mathutil_cat.warning()
31 << get_type() << "::get_volume() called\n";
32
33 // We don't know how to compute the volume of this shape correctly; just
34 // calculate the volume of its containing box.
35 BoundingBox box(get_min(), get_max());
36 box.local_object();
37 return box.get_volume();
38}
39
40/**
41 * Virtual downcast method. Returns this object as a pointer of the indicated
42 * type, if it is in fact that type. Returns NULL if it is not that type.
43 */
48
49/**
50 * Double-dispatch support: called by around_other() when the type of the
51 * first element in the list is known to be a nonempty line.
52 */
53bool FiniteBoundingVolume::
54around_lines(const BoundingVolume **, const BoundingVolume **) {
55 _flags = F_infinite;
56
57 // Since it's a FiniteBoundingVolume, we can't do any better than making it
58 // infinite. So we return true.
59 return true;
60}
61
62/**
63 * Double-dispatch support: called by around_other() when the type of the
64 * first element in the list is known to be a nonempty plane.
65 */
66bool FiniteBoundingVolume::
67around_planes(const BoundingVolume **, const BoundingVolume **) {
68 _flags = F_infinite;
69
70 // Since it's a FiniteBoundingVolume, we can't do any better than making it
71 // infinite. So we return true.
72 return true;
73}
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 is an abstract class for any volume in any sense which can be said to define the locality of ref...
bool is_empty() const
Any kind of volume might be empty.
bool is_infinite() const
The other side of the empty coin is an infinite volume.
A special kind of GeometricBoundingVolume that is known to be finite.
virtual const FiniteBoundingVolume * as_finite_bounding_volume() const
Virtual downcast method.
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.