Skip to content

Commit

Permalink
Add Matrix4x3.mapXZY/YXZ/YZX/ZXY/ZYX()
Browse files Browse the repository at this point in the history
to do simple orthonormal transformations
with the base axes, so "mapping" the axes
onto each other.
httpdigest committed Oct 16, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 21c14ae commit c2beed4
Showing 4 changed files with 342 additions and 0 deletions.
96 changes: 96 additions & 0 deletions src/org/joml/Matrix4x3d.java
Original file line number Diff line number Diff line change
@@ -9887,6 +9887,102 @@ public Matrix4x3d obliqueZ(double a, double b, Matrix4x3d dest) {
return dest;
}

/**
* Multiply <code>this</code> by the matrix
* <pre>
* 1 0 0 0
* 0 0 1 0
* 0 1 0 0
* </pre>
*
* @return this
*/
public Matrix4x3d mapXZY() {
return mapXZY(this);
}
public Matrix4x3d mapXZY(Matrix4x3d dest) {
double m00 = this.m00, m01 = this.m01, m02 = this.m02;
double m10 = this.m10, m11 = this.m11, m12 = this.m12;
double m20 = this.m20, m21 = this.m21, m22 = this.m22;
return dest._m00(m00)._m01(m01)._m02(m02)._m10(m20)._m11(m21)._m12(m22)._m20(m10)._m21(m11)._m22(m12)._m30(m30)._m31(m31)._m32(m32)._properties(properties & PROPERTY_ORTHONORMAL);
}
/**
* Multiply <code>this</code> by the matrix
* <pre>
* 0 1 0 0
* 1 0 0 0
* 0 0 1 0
* </pre>
*
* @return this
*/
public Matrix4x3d mapYXZ() {
return mapYXZ(this);
}
public Matrix4x3d mapYXZ(Matrix4x3d dest) {
double m00 = this.m00, m01 = this.m01, m02 = this.m02;
double m10 = this.m10, m11 = this.m11, m12 = this.m12;
double m20 = this.m20, m21 = this.m21, m22 = this.m22;
return dest._m00(m10)._m01(m11)._m02(m12)._m10(m00)._m11(m01)._m12(m02)._m20(m20)._m21(m21)._m22(m22)._m30(m30)._m31(m31)._m32(m32)._properties(properties & PROPERTY_ORTHONORMAL);
}
/**
* Multiply <code>this</code> by the matrix
* <pre>
* 0 0 1 0
* 1 0 0 0
* 0 1 0 0
* </pre>
*
* @return this
*/
public Matrix4x3d mapYZX() {
return mapYZX(this);
}
public Matrix4x3d mapYZX(Matrix4x3d dest) {
double m00 = this.m00, m01 = this.m01, m02 = this.m02;
double m10 = this.m10, m11 = this.m11, m12 = this.m12;
double m20 = this.m20, m21 = this.m21, m22 = this.m22;
return dest._m00(m10)._m01(m11)._m02(m12)._m10(m20)._m11(m21)._m12(m22)._m20(m00)._m21(m01)._m22(m02)._m30(m30)._m31(m31)._m32(m32)._properties(properties & PROPERTY_ORTHONORMAL);
}
/**
* Multiply <code>this</code> by the matrix
* <pre>
* 0 1 0 0
* 0 0 1 0
* 1 0 0 0
* </pre>
*
* @return this
*/
public Matrix4x3d mapZXY() {
return mapZXY(this);
}
public Matrix4x3d mapZXY(Matrix4x3d dest) {
double m00 = this.m00, m01 = this.m01, m02 = this.m02;
double m10 = this.m10, m11 = this.m11, m12 = this.m12;
double m20 = this.m20, m21 = this.m21, m22 = this.m22;
return dest._m00(m20)._m01(m21)._m02(m22)._m10(m00)._m11(m01)._m12(m02)._m20(m10)._m21(m11)._m22(m12)._m30(m30)._m31(m31)._m32(m32)._properties(properties & PROPERTY_ORTHONORMAL);
}
/**
* Multiply <code>this</code> by the matrix
* <pre>
* 0 0 1 0
* 0 1 0 0
* 1 0 0 0
* </pre>
*
* @return this
*/
public Matrix4x3d mapZYX() {
return mapZYX(this);
}
public Matrix4x3d mapZYX(Matrix4x3d dest) {
double m00 = this.m00, m01 = this.m01, m02 = this.m02;
double m10 = this.m10, m11 = this.m11, m12 = this.m12;
double m20 = this.m20, m21 = this.m21, m22 = this.m22;
return dest._m00(m20)._m01(m21)._m02(m22)._m10(m10)._m11(m11)._m12(m12)._m20(m00)._m21(m01)._m22(m02)._m30(m30)._m31(m31)._m32(m32)._properties(properties & PROPERTY_ORTHONORMAL);
}

public boolean isFinite() {
return Math.isFinite(m00) && Math.isFinite(m01) && Math.isFinite(m02) &&
Math.isFinite(m10) && Math.isFinite(m11) && Math.isFinite(m12) &&
75 changes: 75 additions & 0 deletions src/org/joml/Matrix4x3dc.java
Original file line number Diff line number Diff line change
@@ -3108,6 +3108,81 @@ public interface Matrix4x3dc {
*/
Matrix4x3d obliqueZ(double a, double b, Matrix4x3d dest);

/**
* Multiply <code>this</code> by the matrix
* <pre>
* 1 0 0 0
* 0 0 1 0
* 0 1 0 0
* </pre>
* and store the result in <code>dest</code>.
*
* @param dest
* will hold the result
* @return dest
*/
Matrix4x3d mapXZY(Matrix4x3d dest);

/**
* Multiply <code>this</code> by the matrix
* <pre>
* 0 1 0 0
* 1 0 0 0
* 0 0 1 0
* </pre>
* and store the result in <code>dest</code>.
*
* @param dest
* will hold the result
* @return dest
*/
Matrix4x3d mapYXZ(Matrix4x3d dest);

/**
* Multiply <code>this</code> by the matrix
* <pre>
* 0 0 1 0
* 1 0 0 0
* 0 1 0 0
* </pre>
* and store the result in <code>dest</code>.
*
* @param dest
* will hold the result
* @return dest
*/
Matrix4x3d mapYZX(Matrix4x3d dest);

/**
* Multiply <code>this</code> by the matrix
* <pre>
* 0 1 0 0
* 0 0 1 0
* 1 0 0 0
* </pre>
* and store the result in <code>dest</code>.
*
* @param dest
* will hold the result
* @return dest
*/
Matrix4x3d mapZXY(Matrix4x3d dest);

/**
* Multiply <code>this</code> by the matrix
* <pre>
* 0 0 1 0
* 0 1 0 0
* 1 0 0 0
* </pre>
* and store the result in <code>dest</code>.
*
* @param dest
* will hold the result
* @return dest
*/
Matrix4x3d mapZYX(Matrix4x3d dest);

/**
* Compare the matrix elements of <code>this</code> matrix with the given matrix using the given <code>delta</code>
* and return whether all of them are equal within a maximum difference of <code>delta</code>.
96 changes: 96 additions & 0 deletions src/org/joml/Matrix4x3f.java
Original file line number Diff line number Diff line change
@@ -9063,6 +9063,102 @@ public Matrix4x3f withLookAtUp(float upX, float upY, float upZ, Matrix4x3f dest)
return dest;
}

/**
* Multiply <code>this</code> by the matrix
* <pre>
* 1 0 0 0
* 0 0 1 0
* 0 1 0 0
* </pre>
*
* @return this
*/
public Matrix4x3f mapXZY() {
return mapXZY(this);
}
public Matrix4x3f mapXZY(Matrix4x3f dest) {
float m00 = this.m00, m01 = this.m01, m02 = this.m02;
float m10 = this.m10, m11 = this.m11, m12 = this.m12;
float m20 = this.m20, m21 = this.m21, m22 = this.m22;
return dest._m00(m00)._m01(m01)._m02(m02)._m10(m20)._m11(m21)._m12(m22)._m20(m10)._m21(m11)._m22(m12)._m30(m30)._m31(m31)._m32(m32)._properties(properties & PROPERTY_ORTHONORMAL);
}
/**
* Multiply <code>this</code> by the matrix
* <pre>
* 0 1 0 0
* 1 0 0 0
* 0 0 1 0
* </pre>
*
* @return this
*/
public Matrix4x3f mapYXZ() {
return mapYXZ(this);
}
public Matrix4x3f mapYXZ(Matrix4x3f dest) {
float m00 = this.m00, m01 = this.m01, m02 = this.m02;
float m10 = this.m10, m11 = this.m11, m12 = this.m12;
float m20 = this.m20, m21 = this.m21, m22 = this.m22;
return dest._m00(m10)._m01(m11)._m02(m12)._m10(m00)._m11(m01)._m12(m02)._m20(m20)._m21(m21)._m22(m22)._m30(m30)._m31(m31)._m32(m32)._properties(properties & PROPERTY_ORTHONORMAL);
}
/**
* Multiply <code>this</code> by the matrix
* <pre>
* 0 0 1 0
* 1 0 0 0
* 0 1 0 0
* </pre>
*
* @return this
*/
public Matrix4x3f mapYZX() {
return mapYZX(this);
}
public Matrix4x3f mapYZX(Matrix4x3f dest) {
float m00 = this.m00, m01 = this.m01, m02 = this.m02;
float m10 = this.m10, m11 = this.m11, m12 = this.m12;
float m20 = this.m20, m21 = this.m21, m22 = this.m22;
return dest._m00(m10)._m01(m11)._m02(m12)._m10(m20)._m11(m21)._m12(m22)._m20(m00)._m21(m01)._m22(m02)._m30(m30)._m31(m31)._m32(m32)._properties(properties & PROPERTY_ORTHONORMAL);
}
/**
* Multiply <code>this</code> by the matrix
* <pre>
* 0 1 0 0
* 0 0 1 0
* 1 0 0 0
* </pre>
*
* @return this
*/
public Matrix4x3f mapZXY() {
return mapZXY(this);
}
public Matrix4x3f mapZXY(Matrix4x3f dest) {
float m00 = this.m00, m01 = this.m01, m02 = this.m02;
float m10 = this.m10, m11 = this.m11, m12 = this.m12;
float m20 = this.m20, m21 = this.m21, m22 = this.m22;
return dest._m00(m20)._m01(m21)._m02(m22)._m10(m00)._m11(m01)._m12(m02)._m20(m10)._m21(m11)._m22(m12)._m30(m30)._m31(m31)._m32(m32)._properties(properties & PROPERTY_ORTHONORMAL);
}
/**
* Multiply <code>this</code> by the matrix
* <pre>
* 0 0 1 0
* 0 1 0 0
* 1 0 0 0
* </pre>
*
* @return this
*/
public Matrix4x3f mapZYX() {
return mapZYX(this);
}
public Matrix4x3f mapZYX(Matrix4x3f dest) {
float m00 = this.m00, m01 = this.m01, m02 = this.m02;
float m10 = this.m10, m11 = this.m11, m12 = this.m12;
float m20 = this.m20, m21 = this.m21, m22 = this.m22;
return dest._m00(m20)._m01(m21)._m02(m22)._m10(m10)._m11(m11)._m12(m12)._m20(m00)._m21(m01)._m22(m02)._m30(m30)._m31(m31)._m32(m32)._properties(properties & PROPERTY_ORTHONORMAL);
}

public boolean isFinite() {
return Math.isFinite(m00) && Math.isFinite(m01) && Math.isFinite(m02) &&
Math.isFinite(m10) && Math.isFinite(m11) && Math.isFinite(m12) &&
75 changes: 75 additions & 0 deletions src/org/joml/Matrix4x3fc.java
Original file line number Diff line number Diff line change
@@ -2856,6 +2856,81 @@ public interface Matrix4x3fc {
*/
Matrix4x3f withLookAtUp(float upX, float upY, float upZ, Matrix4x3f dest);

/**
* Multiply <code>this</code> by the matrix
* <pre>
* 1 0 0 0
* 0 0 1 0
* 0 1 0 0
* </pre>
* and store the result in <code>dest</code>.
*
* @param dest
* will hold the result
* @return dest
*/
Matrix4x3f mapXZY(Matrix4x3f dest);

/**
* Multiply <code>this</code> by the matrix
* <pre>
* 0 1 0 0
* 1 0 0 0
* 0 0 1 0
* </pre>
* and store the result in <code>dest</code>.
*
* @param dest
* will hold the result
* @return dest
*/
Matrix4x3f mapYXZ(Matrix4x3f dest);

/**
* Multiply <code>this</code> by the matrix
* <pre>
* 0 0 1 0
* 1 0 0 0
* 0 1 0 0
* </pre>
* and store the result in <code>dest</code>.
*
* @param dest
* will hold the result
* @return dest
*/
Matrix4x3f mapYZX(Matrix4x3f dest);

/**
* Multiply <code>this</code> by the matrix
* <pre>
* 0 1 0 0
* 0 0 1 0
* 1 0 0 0
* </pre>
* and store the result in <code>dest</code>.
*
* @param dest
* will hold the result
* @return dest
*/
Matrix4x3f mapZXY(Matrix4x3f dest);

/**
* Multiply <code>this</code> by the matrix
* <pre>
* 0 0 1 0
* 0 1 0 0
* 1 0 0 0
* </pre>
* and store the result in <code>dest</code>.
*
* @param dest
* will hold the result
* @return dest
*/
Matrix4x3f mapZYX(Matrix4x3f dest);

/**
* Compare the matrix elements of <code>this</code> matrix with the given matrix using the given <code>delta</code>
* and return whether all of them are equal within a maximum difference of <code>delta</code>.

0 comments on commit c2beed4

Please sign in to comment.