Add positive() to Vector and Vector2D

This commit is contained in:
aumgn 2012-03-13 10:05:33 +01:00 committed by TomyLobo
parent 85cdd49593
commit 0346228310
2 changed files with 18 additions and 0 deletions

View File

@ -575,6 +575,15 @@ public class Vector {
return new Vector(Math.floor(x + 0.5), Math.floor(y + 0.5), Math.floor(z + 0.5));
}
/**
* Returns a vector with the absolute values of the components of this vector.
*
* @return
*/
public Vector positive() {
return new Vector(Math.abs(x), Math.abs(y), Math.abs(z));
}
/**
* 2D transformation.
*

View File

@ -501,6 +501,15 @@ public class Vector2D {
return new Vector2D(Math.floor(x + 0.5), Math.floor(z + 0.5));
}
/**
* Returns a vector with the absolute values of the components of this vector.
*
* @return
*/
public Vector2D positive() {
return new Vector2D(Math.abs(x), Math.abs(z));
}
/**
* 2D transformation.
*