Did some minor Vector optimization.

This commit is contained in:
sk89q
2011-01-08 10:59:06 -08:00
parent 2f71a32f64
commit da4480ab49
2 changed files with 14 additions and 1 deletions

View File

@@ -446,6 +446,18 @@ public class Vector {
Math.pow(pt.z - z, 2));
}
/**
* Get the distance away from a point, squared.
*
* @param pt
* @return distance
*/
public double distanceSq(Vector pt) {
return Math.pow(pt.x - x, 2) +
Math.pow(pt.y - y, 2) +
Math.pow(pt.z - z, 2);
}
/**
* Checks to see if a vector is contained with another.
*