Added Vector.lengthSq()

Dieser Commit ist enthalten in:
TomyLobo 2011-12-27 19:03:18 +01:00
Ursprung 0960ce46e2
Commit 48f529bc7a

Datei anzeigen

@ -437,12 +437,19 @@ public class Vector {
/** /**
* Get the length of the vector. * Get the length of the vector.
* *
* @return distance * @return length
*/ */
public double length() { public double length() {
return Math.sqrt(Math.pow(x, 2) + return Math.sqrt(x * x + y * y + z * z);
Math.pow(y, 2) + }
Math.pow(z, 2));
/**
* Get the length^2 of the vector.
*
* @return length^2
*/
public double lengthSq() {
return x * x + y * y + z * z;
} }
/** /**