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) {