Skip to content

Commit

Permalink
Update Matrix4x4fMathExtra.nlvm
Browse files Browse the repository at this point in the history
Added comments
  • Loading branch information
lilkingjr1 committed Jan 4, 2024
1 parent 7e4e3aa commit f3025b5
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
public static void matrixToEuler(Matrix4x4f m, Vector3f e){
// These are not needed because NL2 already has com.nolimitscoaster.Tools.matrixToPitchHeadBankPosScale

public static void matrixToEuler(Matrix4x4f m, Vector3f e){ // Works
// Assuming the angles are in radians.
if (m.elemAt(2,1) > 0.998f){ // singularity at north pole
e.x = (float) (Math.PI/2); // attitude
Expand All @@ -17,7 +19,7 @@ public static void matrixToEuler(Matrix4x4f m, Vector3f e){
e.z = (float) (Math.atan2((double) m.elemAt(0,1), (double) m.elemAt(1,1))); // heading
}

public static void eulerToMatrix(Vector3f e, Matrix4x4f m){
public static void eulerToMatrix(Vector3f e, Matrix4x4f m){ // Doesn't work
// Assuming the angles are in radians.
float ch = (float) (Math.cos((double) e.y));
float sh = (float) (Math.sin((double) e.y));
Expand Down

0 comments on commit f3025b5

Please sign in to comment.