Skip to content
Browse files

Add translate(Vector3f) to Matrix4f and correct some comments. Fixes #1.

  • Loading branch information...
1 parent b410405 commit abf35f8442d58942e6b781c26ea0e35d6451d9c4 @kanelbulle committed Mar 17, 2012
View
4 src/com/github/kanelbulle/oglmathj/Matrix2f.java
@@ -232,9 +232,9 @@ public String toString() {
}
/**
- * Transposes this matrix in place.
+ * Transposes this matrix.
*
- * @return The same matrix after transpose.
+ * @return The transposed matrix.
*/
public Matrix2f transpose() {
tmp_4[M00] = m00;
View
4 src/com/github/kanelbulle/oglmathj/Matrix3f.java
@@ -316,9 +316,9 @@ public String toString() {
}
/**
- * Transposes this matrix in place.
+ * Transposes this matrix.
*
- * @return The same matrix after transpose.
+ * @return The transposed matrix.
*/
public Matrix3f transpose() {
tmp_9[M00] = m00;
View
21 src/com/github/kanelbulle/oglmathj/Matrix4f.java
@@ -342,7 +342,7 @@ public Matrix4f rotate(float angle, Vector3f axis) {
* @param z
* The z component of the axis.
*
- * @return this matrix after rotation.
+ * @return The rotated matrix.
*/
public Matrix4f rotate(float angle, float x, float y, float z) {
float c = (float) Math.cos((double) angle);
@@ -563,9 +563,20 @@ public String toString() {
"%f, %f, %f, %f\n%f, %f, %f, %f\n%f, %f, %f, %f\n%f, %f, %f, %f\n", m00, m01, m02,
m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33);
}
+
+ /**
+ * Translates this matrix by the values in v.
+ *
+ * @param v The vector to translate by.
+ *
+ * @return The translated matrix.
+ */
+ public Matrix4f translate(Vector3f v) {
+ return translate(v.x(), v.y(), v.z());
+ }
/**
- * Translates this matrix in place by the values in x, y and z.
+ * Translates this matrix by the values in x, y and z.
*
* @param x
* The amount to translate by the x axis.
@@ -574,7 +585,7 @@ public String toString() {
* @param z
* The amount to translate by the z axis.
*
- * @return The same matrix after translation.
+ * @return The translated matrix.
*/
public Matrix4f translate(float x, float y, float z) {
tmp_16[M00] = m00;
@@ -601,9 +612,9 @@ public Matrix4f translate(float x, float y, float z) {
}
/**
- * Transposes this matrix in place.
+ * Transposes this matrix.
*
- * @return The same matrix after transpose.
+ * @return The transposed matrix.
*/
public Matrix4f transpose() {
tmp_16[M00] = m00;

0 comments on commit abf35f8

Please sign in to comment.
Something went wrong with that request. Please try again.