- The
BoundingBox.merge() method internally invokes the BoundingBox.mergeLocal() method, which alters the internal state of the BoundingBox object on which it is invoked. In contrast, the BoundingSphere.merge() method correctly creates a new object without altering the internal state of the BoundingSphere object on which it is invoked.
Does anyone else think this behavior is definitely wrong, or is there a hidden reason behind this choice?
https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-core/src/main/java/com/jme3/bounding/BoundingBox.java#L417
https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-core/src/main/java/com/jme3/bounding/BoundingSphere.java#L470
- 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;
}
}
BoundingBox.merge()method internally invokes theBoundingBox.mergeLocal()method, which alters the internal state of theBoundingBoxobject on which it is invoked. In contrast, theBoundingSphere.merge()method correctly creates a new object without altering the internal state of theBoundingSphereobject on which it is invoked.Does anyone else think this behavior is definitely wrong, or is there a hidden reason behind this choice?
https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-core/src/main/java/com/jme3/bounding/BoundingBox.java#L417
https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-core/src/main/java/com/jme3/bounding/BoundingSphere.java#L470
whichSide()method, the<and>comparisons could be standardized: