Added Vector.toVector2D and Vector2D.toVector.

This commit is contained in:
TomyLobo 2012-01-03 00:41:25 +01:00
parent 35230d12d8
commit f11415f451
2 changed files with 18 additions and 0 deletions

View File

@ -619,6 +619,15 @@ public BlockVector toBlockVector() {
return new BlockVector(this);
}
/**
* Creates a 2D vector by dropping the Y component from this vector.
*
* @return Vector2D
*/
public Vector2D toVector2D() {
return new Vector2D(x, z);
}
/**
* Gets the dot product of this and another vector.
*

View File

@ -190,4 +190,13 @@ public int hashCode() {
public String toString() {
return "(" + x + ", " + z + ")";
}
/**
* Creates a 3D vector by adding a zero Y component to this vector.
*
* @return Vector
*/
public Vector toVector() {
return new Vector(x, 0, z);
}
}