Problem where the angle given in the rotation function was not converted to a radian

This commit is contained in:
Antoine
2021-05-17 18:29:58 +02:00
parent 2570553b93
commit 5f4b2aa56e
3 changed files with 12 additions and 9 deletions

View File

@ -51,8 +51,8 @@ public class Matrix4f {
public static Matrix4f rotateX(float angle){
Matrix4f result = identity();
float r = (float) Math.toRadians(angle);
float cos = (float) Math.cos(angle);
float sin = (float) Math.sin(angle);
float cos = (float) Math.cos(r);
float sin = (float) Math.sin(r);
result.elements[1 + 1 * 4] = cos;
result.elements[2 + 1 * 4] = -sin;
@ -66,8 +66,8 @@ public class Matrix4f {
public static Matrix4f rotateY(float angle){
Matrix4f result = identity();
float r = (float) Math.toRadians(angle);
float cos = (float) Math.cos(angle);
float sin = (float) Math.sin(angle);
float cos = (float) Math.cos(r);
float sin = (float) Math.sin(r);
result.elements[0 + 0 * 4] = cos;
result.elements[2 + 0 * 4] = sin;
@ -81,8 +81,8 @@ public class Matrix4f {
public static Matrix4f rotateZ(float angle){
Matrix4f result = identity();
float r = (float) Math.toRadians(angle);
float cos = (float) Math.cos(angle);
float sin = (float) Math.sin(angle);
float cos = (float) Math.cos(r);
float sin = (float) Math.sin(r);
result.elements[0 + 0 * 4] = cos;
result.elements[1 + 0 * 4] = -sin;