Class Matrix4Utils

java.lang.Object
gaiasky.util.math.Matrix4Utils

public class Matrix4Utils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    get(com.badlogic.gdx.math.Matrix4 m, int offset, FloatBuffer src)
     
    static void
    put(com.badlogic.gdx.math.Matrix4 m, FloatBuffer buffer)
     
    static float[]
    recoverEulerAngles(com.badlogic.gdx.math.Matrix4 m)
    Recovers the Euler angles (yaw, pitch, and roll) from the given 4x4 transformation matrix, in degrees.
    static void
    setScaling(com.badlogic.gdx.math.Matrix4 m, float scl)
     
    static void
    setScaling(com.badlogic.gdx.math.Matrix4 m, com.badlogic.gdx.math.Vector3 scl)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Matrix4Utils

      public Matrix4Utils()
  • Method Details

    • setScaling

      public static void setScaling(com.badlogic.gdx.math.Matrix4 m, float scl)
    • setScaling

      public static void setScaling(com.badlogic.gdx.math.Matrix4 m, com.badlogic.gdx.math.Vector3 scl)
    • recoverEulerAngles

      public static float[] recoverEulerAngles(com.badlogic.gdx.math.Matrix4 m)
      Recovers the Euler angles (yaw, pitch, and roll) from the given 4x4 transformation matrix, in degrees.

      This method extracts the yaw, pitch, and roll values from a matrix representing a 3D rotation. The angles are calculated based on the matrix elements. The result is a 3-element array where:

      • Element 0 is the yaw angle (rotation around the Y-axis),
      • Element 1 is the pitch angle (rotation around the X-axis),
      • Element 2 is the roll angle (rotation around the Z-axis).

      In the case of gimbal lock (when the cosine of the pitch is zero), yaw is set to 0 and roll is computed from the matrix elements.

      Parameters:
      m - the 4x4 transformation matrix representing the rotation
      Returns:
      an array of floats containing the Euler angles in the order: [yaw, pitch, roll]
    • put

      public static void put(com.badlogic.gdx.math.Matrix4 m, FloatBuffer buffer)
    • get

      public static void get(com.badlogic.gdx.math.Matrix4 m, int offset, FloatBuffer src)