mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-27 05:00:08 +08:00
Added Vector.lengthSq()
This commit is contained in:
parent
0960ce46e2
commit
48f529bc7a
@ -437,12 +437,19 @@ public Vector divide(float n) {
|
||||
/**
|
||||
* Get the length of the vector.
|
||||
*
|
||||
* @return distance
|
||||
* @return length
|
||||
*/
|
||||
public double length() {
|
||||
return Math.sqrt(Math.pow(x, 2) +
|
||||
Math.pow(y, 2) +
|
||||
Math.pow(z, 2));
|
||||
return Math.sqrt(x * x + y * y + z * z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the length^2 of the vector.
|
||||
*
|
||||
* @return length^2
|
||||
*/
|
||||
public double lengthSq() {
|
||||
return x * x + y * y + z * z;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user