Currently there exists a angleRotation function in the Matrix4f class defined like this:
public void angleRotation(Vector3f angles) {
float angle;
float sr, sp, sy, cr, cp, cy;
angle = (angles.z * FastMath.DEG_TO_RAD);
sy = FastMath.sin(angle);
cy = FastMath.cos(angle);
angle = (angles.y * FastMath.DEG_TO_RAD);
sp = FastMath.sin(angle);
cp = FastMath.cos(angle);
angle = (angles.x * FastMath.DEG_TO_RAD);
sr = FastMath.sin(angle);
cr = FastMath.cos(angle);
// matrix = (Z * Y) * X
m00 = cp * cy;
m10 = cp * sy;
m20 = -sp;
m01 = sr * sp * cy + cr * -sy;
m11 = sr * sp * sy + cr * cy;
m21 = sr * cp;
m02 = (cr * sp * cy + -sr * -sy);
m12 = (cr * sp * sy + -sr * cy);
m22 = cr * cp;
m03 = 0.0f;
m13 = 0.0f;
m23 = 0.0f;
}
I suggest that a radian rotation function is implemented:
public void radianRotation(Vector3f radians) {
float sy = FastMath.sin(radians.z);
float cy = FastMath.cos(radians.z);
float sp = FastMath.sin(radians.y);
float cp = FastMath.cos(radians.y);
float sr = FastMath.sin(radians.x);
float cr = FastMath.cos(radians.x);
// matrix = (Z * Y) * X
m00 = cp * cy;
m10 = cp * sy;
m20 = -sp;
m01 = sr * sp * cy + cr * -sy;
m11 = sr * sp * sy + cr * cy;
m21 = sr * cp;
m02 = (cr * sp * cy + -sr * -sy);
m12 = (cr * sp * sy + -sr * cy);
m22 = cr * cp;
m03 = 0.0f;
m13 = 0.0f;
m23 = 0.0f;
}
}
And that the angle function uses it like this:
public void angleRotation(Vector3f angles) {
radianRotation(angles.mult(FastMath.DEG_TO_RAD));
}
I also suggest that the the inverse rotation functions are changed, so that they can be used with vectors instead of float []. And it would be nice if they were named in a similar way. Now the rotation and invers rotation functions (for degrees) look like this:
public void setInverseRotationDegrees(float[] angles)
public void angleRotation(Vector3f angles)