33 LPoint3 BoundingPlane::
34 get_approx_center()
const {
35 nassertr(!
is_empty(), LPoint3(0.0f, 0.0f, 0.0f));
36 nassertr(!
is_infinite(), LPoint3(0.0f, 0.0f, 0.0f));
37 return _plane.get_point();
44 xform(
const LMatrix4 &mat) {
45 nassertv(!mat.is_nan());
56 output(std::ostream &out)
const {
58 out <<
"bplane, empty";
60 out <<
"bplane, infinite";
62 out <<
"bplane: " << _plane;
80 return other->extend_by_plane(
this);
90 return other->around_planes(first, last);
98 return other->contains_plane(
this);
110 _plane = plane->get_plane();
126 PN_stdfloat r = sphere->get_radius();
127 PN_stdfloat d = _plane.dist_to_plane(sphere->get_center());
131 return IF_all | IF_possible | IF_some;
135 return IF_possible | IF_some;
139 return IF_no_intersection;
152 const LPoint3 &min = box->
get_minq();
153 const LPoint3 &max = box->
get_maxq();
154 LPoint3 center = (min + max) * 0.5f;
155 PN_stdfloat radius2 = (max - center).length_squared();
157 int result = IF_possible | IF_some | IF_all;
159 PN_stdfloat dist = _plane.dist_to_plane(center);
160 PN_stdfloat dist2 = dist * dist;
162 if (dist2 <= radius2) {
168 for (
int i = 0; i < 8 && (all_in || all_out) ; ++i) {
169 if (_plane.dist_to_plane(box->
get_point(i)) < 0.0f) {
179 return IF_no_intersection;
180 }
else if (!all_in) {
184 }
else if (dist >= 0.0f) {
186 return IF_no_intersection;
206 LPlane other_plane = plane->get_plane();
207 PN_stdfloat dot = _plane.get_normal().dot(other_plane.get_normal());
210 if (_plane.get_w() <= other_plane.get_w()) {
211 return IF_possible | IF_some | IF_all;
213 return IF_possible | IF_some;
216 }
else if (dot <= -1.0) {
218 if (_plane.get_w() >= -other_plane.get_w()) {
219 return IF_no_intersection;
221 return IF_possible | IF_some;
226 return IF_possible | IF_some;
239 int result = IF_possible | IF_some | IF_all;
243 for (
int i = 0; i < 8 && (all_in || all_out) ; ++i) {
244 if (_plane.dist_to_plane(hexahedron->
get_point(i)) < 0.0f) {
254 return IF_no_intersection;
255 }
else if (!all_in) {
An axis-aligned bounding box; that is, a minimum and maximum coordinate triple.
get_point
Returns the nth vertex of the rectangular solid.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool is_empty() const
Any kind of volume might be empty.
This defines a bounding sphere, consisting of a center and a radius.
bool is_infinite() const
The other side of the empty coin is an infinite volume.
virtual const BoundingPlane * as_bounding_plane() const
Virtual downcast method.
This funny bounding volume is an infinite plane that divides space into two regions: the part behind ...
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
const LPoint3 & get_maxq() const
An inline accessor for the maximum value.
BoundingPlane()
Constructs an empty "plane" that has no intersections.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_point
Returns the nth vertex of the hexahedron.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
This defines a bounding convex hexahedron.
This funny bounding volume is an infinite line with no thickness and extending to infinity in both di...
const LPoint3 & get_minq() const
An inline accessor for the minimum value.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.