Prevent boundingBox to create new vectors in distanceToEdge thanks to maximusgrey
http://jmonkeyengine.org/groups/graphics/forum/topic/boudingbox-and-vector3fs/#post-140072 git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8077 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
9a44e32fb2
commit
943e4c805d
@ -805,7 +805,10 @@ public class BoundingBox extends BoundingVolume {
|
|||||||
|
|
||||||
public float distanceToEdge(Vector3f point) {
|
public float distanceToEdge(Vector3f point) {
|
||||||
// compute coordinates of point in box coordinate system
|
// compute coordinates of point in box coordinate system
|
||||||
Vector3f closest = point.subtract(center);
|
TempVars vars= TempVars.get();
|
||||||
|
Vector3f closest = vars.vect1;
|
||||||
|
|
||||||
|
point.subtract(center,closest);
|
||||||
|
|
||||||
// project test point onto box
|
// project test point onto box
|
||||||
float sqrDistance = 0.0f;
|
float sqrDistance = 0.0f;
|
||||||
@ -841,6 +844,7 @@ public class BoundingBox extends BoundingVolume {
|
|||||||
closest.z = zExtent;
|
closest.z = zExtent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vars.release();
|
||||||
return FastMath.sqrt(sqrDistance);
|
return FastMath.sqrt(sqrDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user