Class MatrixNf

    • Field Detail

      • IDENTITY_2

        public static final MatrixNf IDENTITY_2
      • IDENTITY_3

        public static final MatrixNf IDENTITY_3
      • IDENTITY_4

        public static final MatrixNf IDENTITY_4
    • Constructor Detail

      • MatrixNf

        public MatrixNf​(int size)
      • MatrixNf

        public MatrixNf​(Matrix2f m)
      • MatrixNf

        public MatrixNf​(Matrix3f m)
      • MatrixNf

        public MatrixNf​(Matrix4f m)
      • MatrixNf

        public MatrixNf​(float... m)
      • MatrixNf

        public MatrixNf​(MatrixNf m)
    • Method Detail

      • size

        public int size()
      • get

        public float get​(int row,
                         int col)
        Specified by:
        get in interface Matrixf
      • set

        public void set​(int row,
                        int col,
                        double val)
      • set

        public void set​(int row,
                        int col,
                        float val)
      • setIdentity

        public final void setIdentity()
      • setZero

        public void setZero()
      • resize

        public MatrixNf resize​(int size)
      • mul

        public MatrixNf mul​(double a)
      • div

        public MatrixNf div​(double a)
      • pow

        public MatrixNf pow​(double pow)
      • translate

        public MatrixNf translate​(float... v)
      • scale

        public MatrixNf scale​(float... v)
      • transform

        public VectorNf transform​(float... vec)
      • trace

        public float trace()
        Specified by:
        trace in interface Matrixf
      • determinant

        public float determinant()
        Specified by:
        determinant in interface Matrixf
      • toMatrix2

        public Matrix2f toMatrix2()
      • toMatrix3

        public Matrix3f toMatrix3()
      • toMatrix4

        public Matrix4f toMatrix4()
      • toArray

        public float[] toArray()
      • toArray

        public float[] toArray​(boolean columnMajor)
        Specified by:
        toArray in interface Matrixf
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • createScaling

        public static MatrixNf createScaling​(float... vec)
      • createTranslation

        public static MatrixNf createTranslation​(float... vec)
      • createRotation

        public static MatrixNf createRotation​(int size,
                                              Complexf rot)
      • createLookAt

        public static MatrixNf createLookAt​(int size,
                                            Vector3f eye,
                                            Vector3f at,
                                            Vector3f up)
        Creates a "look at" matrix for the given eye point.
        Parameters:
        size - The size of the matrix, minimum of 4
        eye - The position of the camera
        at - The point that the camera is looking at
        up - The "up" vector
        Returns:
        A rotational transform that corresponds to a camera looking at the given point
      • createPerspective

        public static MatrixNf createPerspective​(int size,
                                                 double fov,
                                                 double aspect,
                                                 double near,
                                                 double far)
        Creates a perspective projection matrix with the given (x) FOV, aspect, near and far planes
        Parameters:
        size - The size of the matrix, minimum of 4
        fov - The field of view in the x direction
        aspect - The aspect ratio, usually width/height
        near - The near plane, cannot be 0
        far - the far plane, zFar cannot equal zNear
        Returns:
        A perspective projection matrix built from the given values
      • createPerspective

        public static MatrixNf createPerspective​(int size,
                                                 float fov,
                                                 float aspect,
                                                 float near,
                                                 float far)
        Creates a perspective projection matrix with the given (x) FOV, aspect, near and far planes
        Parameters:
        size - The size of the matrix, minimum of 4
        fov - The field of view in the x direction
        aspect - The aspect ratio, usually width/height
        near - The near plane, cannot be 0
        far - the far plane, zFar cannot equal zNear
        Returns:
        A perspective projection matrix built from the given values
      • createOrthographic

        public static MatrixNf createOrthographic​(int size,
                                                  double right,
                                                  double left,
                                                  double top,
                                                  double bottom,
                                                  double near,
                                                  double far)
        Creates an orthographic viewing frustum built from the provided values
        Parameters:
        size - The size of the matrix, minimum of 4
        right - the right most plane of the viewing frustum
        left - the left most plane of the viewing frustum
        top - the top plane of the viewing frustum
        bottom - the bottom plane of the viewing frustum
        near - the near plane of the viewing frustum
        far - the far plane of the viewing frustum
        Returns:
        A viewing frustum built from the provided values
      • createOrthographic

        public static MatrixNf createOrthographic​(int size,
                                                  float right,
                                                  float left,
                                                  float top,
                                                  float bottom,
                                                  float near,
                                                  float far)
        Creates an orthographic viewing frustum built from the provided values
        Parameters:
        size - The size of the matrix, minimum of 4
        right - the right most plane of the viewing frustum
        left - the left most plane of the viewing frustum
        top - the top plane of the viewing frustum
        bottom - the bottom plane of the viewing frustum
        near - the near plane of the viewing frustum
        far - the far plane of the viewing frustum
        Returns:
        A viewing frustum built from the provided values