Skip to content

Commit

Permalink
Remove unnecessary local variables and set all matrix fields (#305)
Browse files Browse the repository at this point in the history
in Matrix4/4x3.rotateTranslationInternal()
  • Loading branch information
httpdigest committed Dec 20, 2021
1 parent 1ba8c57 commit 489f439
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 47 deletions.
27 changes: 10 additions & 17 deletions src/org/joml/Matrix4d.java
Original file line number Diff line number Diff line change
Expand Up @@ -4844,31 +4844,24 @@ private Matrix4d rotateTranslationInternal(double ang, double x, double y, doubl
double rm20 = xz * C + y * s;
double rm21 = yz * C - x * s;
double rm22 = zz * C + c;
double nm00 = rm00;
double nm01 = rm01;
double nm02 = rm02;
double nm10 = rm10;
double nm11 = rm11;
double nm12 = rm12;
// set non-dependent values directly
dest._m20(rm20)
return dest
._m20(rm20)
._m21(rm21)
._m22(rm22)
// set other values
._m00(nm00)
._m01(nm01)
._m02(nm02)
._m23(0.0)
._m00(rm00)
._m01(rm01)
._m02(rm02)
._m03(0.0)
._m10(nm10)
._m11(nm11)
._m12(nm12)
._m10(rm10)
._m11(rm11)
._m12(rm12)
._m13(0.0)
._m30(m30)
._m31(m31)
._m32(m32)
._m33(m33)
._m33(1.0)
._properties(properties & ~(PROPERTY_PERSPECTIVE | PROPERTY_IDENTITY | PROPERTY_TRANSLATION));
return dest;
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/org/joml/Matrix4f.java
Original file line number Diff line number Diff line change
Expand Up @@ -5900,6 +5900,7 @@ private Matrix4f rotateTranslationInternal(float ang, float x, float y, float z,
._m20(rm20)
._m21(rm21)
._m22(rm22)
._m23(0.0f)
._m00(rm00)
._m01(rm01)
._m02(rm02)
Expand Down
21 changes: 6 additions & 15 deletions src/org/joml/Matrix4x3d.java
Original file line number Diff line number Diff line change
Expand Up @@ -3226,28 +3226,19 @@ private Matrix4x3d rotateTranslationInternal(double ang, double x, double y, dou
double rm20 = xz * C + y * s;
double rm21 = yz * C - x * s;
double rm22 = zz * C + c;
double nm00 = rm00;
double nm01 = rm01;
double nm02 = rm02;
double nm10 = rm10;
double nm11 = rm11;
double nm12 = rm12;
// set non-dependent values directly
dest.m20 = rm20;
dest.m21 = rm21;
dest.m22 = rm22;
// set other values
dest.m00 = nm00;
dest.m01 = nm01;
dest.m02 = nm02;
dest.m10 = nm10;
dest.m11 = nm11;
dest.m12 = nm12;
dest.m00 = rm00;
dest.m01 = rm01;
dest.m02 = rm02;
dest.m10 = rm10;
dest.m11 = rm11;
dest.m12 = rm12;
dest.m30 = m30;
dest.m31 = m31;
dest.m32 = m32;
dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION);

return dest;
}

Expand Down
21 changes: 6 additions & 15 deletions src/org/joml/Matrix4x3f.java
Original file line number Diff line number Diff line change
Expand Up @@ -3923,28 +3923,19 @@ private Matrix4x3f rotateTranslationInternal(float ang, float x, float y, float
float rm20 = xz * C + y * s;
float rm21 = yz * C - x * s;
float rm22 = zz * C + c;
float nm00 = rm00;
float nm01 = rm01;
float nm02 = rm02;
float nm10 = rm10;
float nm11 = rm11;
float nm12 = rm12;
// set non-dependent values directly
dest.m20 = rm20;
dest.m21 = rm21;
dest.m22 = rm22;
// set other values
dest.m00 = nm00;
dest.m01 = nm01;
dest.m02 = nm02;
dest.m10 = nm10;
dest.m11 = nm11;
dest.m12 = nm12;
dest.m00 = rm00;
dest.m01 = rm01;
dest.m02 = rm02;
dest.m10 = rm10;
dest.m11 = rm11;
dest.m12 = rm12;
dest.m30 = m30;
dest.m31 = m31;
dest.m32 = m32;
dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION);

return dest;
}

Expand Down

0 comments on commit 489f439

Please sign in to comment.