Fixed minor issues, moved some classes.
This commit is contained in:
@@ -434,6 +434,18 @@ public class Vector {
|
||||
return new Vector(x / n, y / n, z / n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the length of the vector.
|
||||
*
|
||||
* @param pt
|
||||
* @return distance
|
||||
*/
|
||||
public double length() {
|
||||
return Math.sqrt(Math.pow(x, 2) +
|
||||
Math.pow(y, 2) +
|
||||
Math.pow(z, 2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the distance away from a point.
|
||||
*
|
||||
@@ -458,6 +470,16 @@ public class Vector {
|
||||
Math.pow(pt.z - z, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the normalized vector.
|
||||
*
|
||||
* @param pt
|
||||
* @return vector
|
||||
*/
|
||||
public Vector normalize() {
|
||||
return divide(length());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if a vector is contained with another.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user