-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
defectSomething that is supposed to work, but doesn't. Less severe than a "bug"Something that is supposed to work, but doesn't. Less severe than a "bug"question
Description
- The
BoundingBox.merge()
method internally invokes theBoundingBox.mergeLocal()
method, which alters the internal state of theBoundingBox
object on which it is invoked. In contrast, theBoundingSphere.merge()
method correctly creates a new object without altering the internal state of theBoundingSphere
object on which it is invoked.
Does anyone else think this behavior is definitely wrong, or is there a hidden reason behind this choice?
- Even in the
whichSide()
method, the<
and>
comparisons could be standardized:
// from BoundingBox
@Override
public Plane.Side whichSide(Plane plane) {
float radius = FastMath.abs(xExtent * plane.getNormal().getX())
+ FastMath.abs(yExtent * plane.getNormal().getY())
+ FastMath.abs(zExtent * plane.getNormal().getZ());
float distance = plane.pseudoDistance(center);
//changed to < and > to prevent floating point precision problems
if (distance < -radius) {
return Plane.Side.Negative;
} else if (distance > radius) {
return Plane.Side.Positive;
} else {
return Plane.Side.None;
}
}
// from BoundingSphere
@Override
public Plane.Side whichSide(Plane plane) {
float distance = plane.pseudoDistance(center);
if (distance <= -radius) {
return Plane.Side.Negative;
} else if (distance >= radius) {
return Plane.Side.Positive;
} else {
return Plane.Side.None;
}
}
Metadata
Metadata
Assignees
Labels
defectSomething that is supposed to work, but doesn't. Less severe than a "bug"Something that is supposed to work, but doesn't. Less severe than a "bug"question