Skip to content

Commit

Permalink
Add Matrix4x3.mul3x3(elements...)
Browse files Browse the repository at this point in the history
  • Loading branch information
httpdigest committed Oct 16, 2021
1 parent 3374227 commit 21c14ae
Show file tree
Hide file tree
Showing 4 changed files with 186 additions and 0 deletions.
59 changes: 59 additions & 0 deletions src/org/joml/Matrix4x3d.java
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,65 @@ public Matrix4x3d mulOrtho(Matrix4x3dc view, Matrix4x3d dest) {
return dest;
}

/**
* Multiply <code>this</code> by the 4x3 matrix with the column vectors <code>(rm00, rm01, rm02)</code>,
* <code>(rm10, rm11, rm12)</code>, <code>(rm20, rm21, rm22)</code> and <code>(0, 0, 0)</code>.
* <p>
* If <code>M</code> is <code>this</code> matrix and <code>R</code> the specified matrix,
* then the new matrix will be <code>M * R</code>. So when transforming a
* vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
* transformation of the <code>R</code> matrix will be applied first!
*
* @param rm00
* the value of the m00 element
* @param rm01
* the value of the m01 element
* @param rm02
* the value of the m02 element
* @param rm10
* the value of the m10 element
* @param rm11
* the value of the m11 element
* @param rm12
* the value of the m12 element
* @param rm20
* the value of the m20 element
* @param rm21
* the value of the m21 element
* @param rm22
* the value of the m22 element
* @return this
*/
public Matrix4x3d mul3x3(
double rm00, double rm01, double rm02,
double rm10, double rm11, double rm12,
double rm20, double rm21, double rm22) {
return mul3x3(rm00, rm01, rm02, rm10, rm11, rm12, rm20, rm21, rm22, this);
}
public Matrix4x3d mul3x3(
double rm00, double rm01, double rm02,
double rm10, double rm11, double rm12,
double rm20, double rm21, double rm22,
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(Math.fma(m00, rm00, Math.fma(m10, rm01, m20 * rm02)))
._m01(Math.fma(m01, rm00, Math.fma(m11, rm01, m21 * rm02)))
._m02(Math.fma(m02, rm00, Math.fma(m12, rm01, m22 * rm02)))
._m10(Math.fma(m00, rm10, Math.fma(m10, rm11, m20 * rm12)))
._m11(Math.fma(m01, rm10, Math.fma(m11, rm11, m21 * rm12)))
._m12(Math.fma(m02, rm10, Math.fma(m12, rm11, m22 * rm12)))
._m20(Math.fma(m00, rm20, Math.fma(m10, rm21, m20 * rm22)))
._m21(Math.fma(m01, rm20, Math.fma(m11, rm21, m21 * rm22)))
._m22(Math.fma(m02, rm20, Math.fma(m12, rm21, m22 * rm22)))
._m30(m30)
._m31(m31)
._m32(m32)
._properties(0);
}

/**
* Component-wise add <code>this</code> and <code>other</code>
* by first multiplying each component of <code>other</code> by <code>otherFactor</code> and
Expand Down
34 changes: 34 additions & 0 deletions src/org/joml/Matrix4x3dc.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,40 @@ public interface Matrix4x3dc {
*/
Matrix4x3d mulOrtho(Matrix4x3dc view, Matrix4x3d dest);

/**
* Multiply <code>this</code> by the 4x3 matrix with the column vectors <code>(rm00, rm01, rm02)</code>,
* <code>(rm10, rm11, rm12)</code>, <code>(rm20, rm21, rm22)</code> and <code>(0, 0, 0)</code>
* and store the result in <code>dest</code>.
* <p>
* If <code>M</code> is <code>this</code> matrix and <code>R</code> the specified matrix,
* then the new matrix will be <code>M * R</code>. So when transforming a
* vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
* transformation of the <code>R</code> matrix will be applied first!
*
* @param rm00
* the value of the m00 element
* @param rm01
* the value of the m01 element
* @param rm02
* the value of the m02 element
* @param rm10
* the value of the m10 element
* @param rm11
* the value of the m11 element
* @param rm12
* the value of the m12 element
* @param rm20
* the value of the m20 element
* @param rm21
* the value of the m21 element
* @param rm22
* the value of the m22 element
* @param dest
* will hold the result
* @return dest
*/
Matrix4x3d mul3x3(double rm00, double rm01, double rm02, double rm10, double rm11, double rm12, double rm20, double rm21, double rm22, Matrix4x3d dest);

/**
* Component-wise add <code>this</code> and <code>other</code>
* by first multiplying each component of <code>other</code> by <code>otherFactor</code>,
Expand Down
59 changes: 59 additions & 0 deletions src/org/joml/Matrix4x3f.java
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,65 @@ public Matrix4x3f mulOrtho(Matrix4x3fc view, Matrix4x3f dest) {
return dest;
}

/**
* Multiply <code>this</code> by the 4x3 matrix with the column vectors <code>(rm00, rm01, rm02)</code>,
* <code>(rm10, rm11, rm12)</code>, <code>(rm20, rm21, rm22)</code> and <code>(0, 0, 0)</code>.
* <p>
* If <code>M</code> is <code>this</code> matrix and <code>R</code> the specified matrix,
* then the new matrix will be <code>M * R</code>. So when transforming a
* vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
* transformation of the <code>R</code> matrix will be applied first!
*
* @param rm00
* the value of the m00 element
* @param rm01
* the value of the m01 element
* @param rm02
* the value of the m02 element
* @param rm10
* the value of the m10 element
* @param rm11
* the value of the m11 element
* @param rm12
* the value of the m12 element
* @param rm20
* the value of the m20 element
* @param rm21
* the value of the m21 element
* @param rm22
* the value of the m22 element
* @return this
*/
public Matrix4x3f mul3x3(
float rm00, float rm01, float rm02,
float rm10, float rm11, float rm12,
float rm20, float rm21, float rm22) {
return mul3x3(rm00, rm01, rm02, rm10, rm11, rm12, rm20, rm21, rm22, this);
}
public Matrix4x3f mul3x3(
float rm00, float rm01, float rm02,
float rm10, float rm11, float rm12,
float rm20, float rm21, float rm22,
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(Math.fma(m00, rm00, Math.fma(m10, rm01, m20 * rm02)))
._m01(Math.fma(m01, rm00, Math.fma(m11, rm01, m21 * rm02)))
._m02(Math.fma(m02, rm00, Math.fma(m12, rm01, m22 * rm02)))
._m10(Math.fma(m00, rm10, Math.fma(m10, rm11, m20 * rm12)))
._m11(Math.fma(m01, rm10, Math.fma(m11, rm11, m21 * rm12)))
._m12(Math.fma(m02, rm10, Math.fma(m12, rm11, m22 * rm12)))
._m20(Math.fma(m00, rm20, Math.fma(m10, rm21, m20 * rm22)))
._m21(Math.fma(m01, rm20, Math.fma(m11, rm21, m21 * rm22)))
._m22(Math.fma(m02, rm20, Math.fma(m12, rm21, m22 * rm22)))
._m30(m30)
._m31(m31)
._m32(m32)
._properties(0);
}

/**
* Component-wise add <code>this</code> and <code>other</code>
* by first multiplying each component of <code>other</code> by <code>otherFactor</code> and
Expand Down
34 changes: 34 additions & 0 deletions src/org/joml/Matrix4x3fc.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,40 @@ public interface Matrix4x3fc {
*/
Matrix4x3f mulOrtho(Matrix4x3fc view, Matrix4x3f dest);

/**
* Multiply <code>this</code> by the 4x3 matrix with the column vectors <code>(rm00, rm01, rm02)</code>,
* <code>(rm10, rm11, rm12)</code>, <code>(rm20, rm21, rm22)</code> and <code>(0, 0, 0)</code>
* and store the result in <code>dest</code>.
* <p>
* If <code>M</code> is <code>this</code> matrix and <code>R</code> the specified matrix,
* then the new matrix will be <code>M * R</code>. So when transforming a
* vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
* transformation of the <code>R</code> matrix will be applied first!
*
* @param rm00
* the value of the m00 element
* @param rm01
* the value of the m01 element
* @param rm02
* the value of the m02 element
* @param rm10
* the value of the m10 element
* @param rm11
* the value of the m11 element
* @param rm12
* the value of the m12 element
* @param rm20
* the value of the m20 element
* @param rm21
* the value of the m21 element
* @param rm22
* the value of the m22 element
* @param dest
* will hold the result
* @return dest
*/
Matrix4x3f mul3x3(float rm00, float rm01, float rm02, float rm10, float rm11, float rm12, float rm20, float rm21, float rm22, Matrix4x3f dest);

/**
* Component-wise add <code>this</code> and <code>other</code>
* by first multiplying each component of <code>other</code> by <code>otherFactor</code>,
Expand Down

0 comments on commit 21c14ae

Please sign in to comment.