Skip to content

Commit

Permalink
Mat44: re-order methods
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Feb 22, 2025
1 parent 03a5b6a commit 32ed171
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions src/main/java/com/github/stephengold/joltjni/Mat44.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,28 @@ public static Mat44 sRotation(Vec3Arg axis, float angle) {
return result;
}

/**
* Create a translation-and-rotation matrix.
*
* @param rotation the amount to rotate (not null, unaffected)
* @param offset the amount to translate (not null, unaffected)
* @return a new object
*/
public static Mat44 sRotationTranslation(QuatArg rotation, Vec3Arg offset) {
float[] floatArray = new float[7];
floatArray[0] = rotation.getX();
floatArray[1] = rotation.getY();
floatArray[2] = rotation.getZ();
floatArray[3] = rotation.getW();
floatArray[4] = offset.getX();
floatArray[5] = offset.getY();
floatArray[6] = offset.getZ();
long matrixVa = createRotationTranslation(floatArray);
Mat44 result = new Mat44(matrixVa, true);

return result;
}

/**
* Create a matrix for the specified X-axis rotation.
*
Expand Down Expand Up @@ -318,22 +340,14 @@ public static Mat44 sRotationZ(float angle) {
}

/**
* Create a translation-and-rotation matrix.
* Create a uniform scaling matrix.
*
* @param factor the amount to scale each axis
* @return a new instance
*
* @param rotation the amount to rotate (not null, unaffected)
* @param offset the amount to translate (not null, unaffected)
* @return a new object
*/
public static Mat44 sRotationTranslation(QuatArg rotation, Vec3Arg offset) {
float[] floatArray = new float[7];
floatArray[0] = rotation.getX();
floatArray[1] = rotation.getY();
floatArray[2] = rotation.getZ();
floatArray[3] = rotation.getW();
floatArray[4] = offset.getX();
floatArray[5] = offset.getY();
floatArray[6] = offset.getZ();
long matrixVa = createRotationTranslation(floatArray);
public static Mat44 sScale(float factor) {
long matrixVa = createScale(factor, factor, factor);
Mat44 result = new Mat44(matrixVa, true);

return result;
Expand All @@ -356,20 +370,6 @@ public static Mat44 sScale(Vec3Arg factors) {
return result;
}

/**
* Create a uniform scaling matrix.
*
* @param factor the amount to scale each axis
* @return a new instance
*
*/
public static Mat44 sScale(float factor) {
long matrixVa = createScale(factor, factor, factor);
Mat44 result = new Mat44(matrixVa, true);

return result;
}

/**
* Create a pure translation matrix.
*
Expand Down

0 comments on commit 32ed171

Please sign in to comment.