IT. Expert System.

Android Reference

Matrix


android.opengl

Class Matrix



  • public class Matrix
    extends Object
    Matrix math utilities. These methods operate on OpenGL ES format matrices and vectors stored in float arrays. Matrices are 4 x 4 column-vector matrices stored in column-major order:
      m[offset +  0] m[offset +  4] m[offset +  8] m[offset + 12]
      m[offset +  1] m[offset +  5] m[offset +  9] m[offset + 13]
      m[offset +  2] m[offset +  6] m[offset + 10] m[offset + 14]
      m[offset +  3] m[offset +  7] m[offset + 11] m[offset + 15]
     
    Vectors are 4 row x 1 column column-vectors stored in order:
     v[offset + 0]
     v[offset + 1]
     v[offset + 2]
     v[offset + 3]
     
    • Constructor Summary

      Constructors
      Constructor and Description
      Matrix()
    • Method Summary

      Methods
      Modifier and Type Method and Description
      static void frustumM(float[] m, int offset, float left, float right, float bottom, float top, float near, float far)
      Define a projection matrix in terms of six clip planes
      static boolean invertM(float[] mInv, int mInvOffset, float[] m, int mOffset)
      Inverts a 4 x 4 matrix.
      static float length(float x, float y, float z)
      Computes the length of a vector
      static void multiplyMM(float[] result, int resultOffset, float[] lhs, int lhsOffset, float[] rhs, int rhsOffset)
      Multiply two 4x4 matrices together and store the result in a third 4x4 matrix.
      static void multiplyMV(float[] resultVec, int resultVecOffset, float[] lhsMat, int lhsMatOffset, float[] rhsVec, int rhsVecOffset)
      Multiply a 4 element vector by a 4x4 matrix and store the result in a 4 element column vector.
      static void orthoM(float[] m, int mOffset, float left, float right, float bottom, float top, float near, float far)
      Computes an orthographic projection matrix.
      static void perspectiveM(float[] m, int offset, float fovy, float aspect, float zNear, float zFar)
      Define a projection matrix in terms of a field of view angle, an aspect ratio, and z clip planes
      static void rotateM(float[] rm, int rmOffset, float[] m, int mOffset, float a, float x, float y, float z)
      Rotates matrix m by angle a (in degrees) around the axis (x, y, z)
      static void rotateM(float[] m, int mOffset, float a, float x, float y, float z)
      Rotates matrix m in place by angle a (in degrees) around the axis (x, y, z)
      static void scaleM(float[] sm, int smOffset, float[] m, int mOffset, float x, float y, float z)
      Scales matrix m by x, y, and z, putting the result in sm
      static void scaleM(float[] m, int mOffset, float x, float y, float z)
      Scales matrix m in place by sx, sy, and sz
      static void setIdentityM(float[] sm, int smOffset)
      Sets matrix m to the identity matrix.
      static void setLookAtM(float[] rm, int rmOffset, float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
      Define a viewing transformation in terms of an eye point, a center of view, and an up vector.
      static void setRotateEulerM(float[] rm, int rmOffset, float x, float y, float z)
      Converts Euler angles to a rotation matrix
      static void setRotateM(float[] rm, int rmOffset, float a, float x, float y, float z)
      Rotates matrix m by angle a (in degrees) around the axis (x, y, z)
      static void translateM(float[] tm, int tmOffset, float[] m, int mOffset, float x, float y, float z)
      Translates matrix m by x, y, and z, putting the result in tm
      static void translateM(float[] m, int mOffset, float x, float y, float z)
      Translates matrix m by x, y, and z in place.
      static void transposeM(float[] mTrans, int mTransOffset, float[] m, int mOffset)
      Transposes a 4 x 4 matrix.
    • Constructor Detail

      • Matrix

        public Matrix()
    • Method Detail

      • multiplyMM

        public static void multiplyMM(float[] result,
                      int resultOffset,
                      float[] lhs,
                      int lhsOffset,
                      float[] rhs,
                      int rhsOffset)
        Multiply two 4x4 matrices together and store the result in a third 4x4 matrix. In matrix notation: result = lhs x rhs. Due to the way matrix multiplication works, the result matrix will have the same effect as first multiplying by the rhs matrix, then multiplying by the lhs matrix. This is the opposite of what you might expect. The same float array may be passed for result, lhs, and/or rhs. However, the result element values are undefined if the result elements overlap either the lhs or rhs elements.
        Parameters:
        result - The float array that holds the result.
        resultOffset - The offset into the result array where the result is stored.
        lhs - The float array that holds the left-hand-side matrix.
        lhsOffset - The offset into the lhs array where the lhs is stored
        rhs - The float array that holds the right-hand-side matrix.
        rhsOffset - The offset into the rhs array where the rhs is stored.
        Throws:
        IllegalArgumentException - if result, lhs, or rhs are null, or if resultOffset + 16 > result.length or lhsOffset + 16 > lhs.length or rhsOffset + 16 > rhs.length.
      • multiplyMV

        public static void multiplyMV(float[] resultVec,
                      int resultVecOffset,
                      float[] lhsMat,
                      int lhsMatOffset,
                      float[] rhsVec,
                      int rhsVecOffset)
        Multiply a 4 element vector by a 4x4 matrix and store the result in a 4 element column vector. In matrix notation: result = lhs x rhs The same float array may be passed for resultVec, lhsMat, and/or rhsVec. However, the resultVec element values are undefined if the resultVec elements overlap either the lhsMat or rhsVec elements.
        Parameters:
        resultVec - The float array that holds the result vector.
        resultVecOffset - The offset into the result array where the result vector is stored.
        lhsMat - The float array that holds the left-hand-side matrix.
        lhsMatOffset - The offset into the lhs array where the lhs is stored
        rhsVec - The float array that holds the right-hand-side vector.
        rhsVecOffset - The offset into the rhs vector where the rhs vector is stored.
        Throws:
        IllegalArgumentException - if resultVec, lhsMat, or rhsVec are null, or if resultVecOffset + 4 > resultVec.length or lhsMatOffset + 16 > lhsMat.length or rhsVecOffset + 4 > rhsVec.length.
      • transposeM

        public static void transposeM(float[] mTrans,
                      int mTransOffset,
                      float[] m,
                      int mOffset)
        Transposes a 4 x 4 matrix.
        Parameters:
        mTrans - the array that holds the output inverted matrix
        mTransOffset - an offset into mInv where the inverted matrix is stored.
        m - the input array
        mOffset - an offset into m where the matrix is stored.
      • invertM

        public static boolean invertM(float[] mInv,
                      int mInvOffset,
                      float[] m,
                      int mOffset)
        Inverts a 4 x 4 matrix.
        Parameters:
        mInv - the array that holds the output inverted matrix
        mInvOffset - an offset into mInv where the inverted matrix is stored.
        m - the input array
        mOffset - an offset into m where the matrix is stored.
        Returns:
        true if the matrix could be inverted, false if it could not.
      • orthoM

        public static void orthoM(float[] m,
                  int mOffset,
                  float left,
                  float right,
                  float bottom,
                  float top,
                  float near,
                  float far)
        Computes an orthographic projection matrix.
        Parameters:
        m - returns the result
        mOffset -
        left -
        right -
        bottom -
        top -
        near -
        far -
      • frustumM

        public static void frustumM(float[] m,
                    int offset,
                    float left,
                    float right,
                    float bottom,
                    float top,
                    float near,
                    float far)
        Define a projection matrix in terms of six clip planes
        Parameters:
        m - the float array that holds the perspective matrix
        offset - the offset into float array m where the perspective matrix data is written
        left -
        right -
        bottom -
        top -
        near -
        far -
      • perspectiveM

        public static void perspectiveM(float[] m,
                        int offset,
                        float fovy,
                        float aspect,
                        float zNear,
                        float zFar)
        Define a projection matrix in terms of a field of view angle, an aspect ratio, and z clip planes
        Parameters:
        m - the float array that holds the perspective matrix
        offset - the offset into float array m where the perspective matrix data is written
        fovy - field of view in y direction, in degrees
        aspect - width to height aspect ratio of the viewport
        zNear -
        zFar -
      • length

        public static float length(float x,
                   float y,
                   float z)
        Computes the length of a vector
        Parameters:
        x - x coordinate of a vector
        y - y coordinate of a vector
        z - z coordinate of a vector
        Returns:
        the length of a vector
      • setIdentityM

        public static void setIdentityM(float[] sm,
                        int smOffset)
        Sets matrix m to the identity matrix.
        Parameters:
        sm - returns the result
        smOffset - index into sm where the result matrix starts
      • scaleM

        public static void scaleM(float[] sm,
                  int smOffset,
                  float[] m,
                  int mOffset,
                  float x,
                  float y,
                  float z)
        Scales matrix m by x, y, and z, putting the result in sm
        Parameters:
        sm - returns the result
        smOffset - index into sm where the result matrix starts
        m - source matrix
        mOffset - index into m where the source matrix starts
        x - scale factor x
        y - scale factor y
        z - scale factor z
      • scaleM

        public static void scaleM(float[] m,
                  int mOffset,
                  float x,
                  float y,
                  float z)
        Scales matrix m in place by sx, sy, and sz
        Parameters:
        m - matrix to scale
        mOffset - index into m where the matrix starts
        x - scale factor x
        y - scale factor y
        z - scale factor z
      • translateM

        public static void translateM(float[] tm,
                      int tmOffset,
                      float[] m,
                      int mOffset,
                      float x,
                      float y,
                      float z)
        Translates matrix m by x, y, and z, putting the result in tm
        Parameters:
        tm - returns the result
        tmOffset - index into sm where the result matrix starts
        m - source matrix
        mOffset - index into m where the source matrix starts
        x - translation factor x
        y - translation factor y
        z - translation factor z
      • translateM

        public static void translateM(float[] m,
                      int mOffset,
                      float x,
                      float y,
                      float z)
        Translates matrix m by x, y, and z in place.
        Parameters:
        m - matrix
        mOffset - index into m where the matrix starts
        x - translation factor x
        y - translation factor y
        z - translation factor z
      • rotateM

        public static void rotateM(float[] rm,
                   int rmOffset,
                   float[] m,
                   int mOffset,
                   float a,
                   float x,
                   float y,
                   float z)
        Rotates matrix m by angle a (in degrees) around the axis (x, y, z)
        Parameters:
        rm - returns the result
        rmOffset - index into rm where the result matrix starts
        m - source matrix
        mOffset - index into m where the source matrix starts
        a - angle to rotate in degrees
        x - scale factor x
        y - scale factor y
        z - scale factor z
      • rotateM

        public static void rotateM(float[] m,
                   int mOffset,
                   float a,
                   float x,
                   float y,
                   float z)
        Rotates matrix m in place by angle a (in degrees) around the axis (x, y, z)
        Parameters:
        m - source matrix
        mOffset - index into m where the matrix starts
        a - angle to rotate in degrees
        x - scale factor x
        y - scale factor y
        z - scale factor z
      • setRotateM

        public static void setRotateM(float[] rm,
                      int rmOffset,
                      float a,
                      float x,
                      float y,
                      float z)
        Rotates matrix m by angle a (in degrees) around the axis (x, y, z)
        Parameters:
        rm - returns the result
        rmOffset - index into rm where the result matrix starts
        a - angle to rotate in degrees
        x - scale factor x
        y - scale factor y
        z - scale factor z
      • setRotateEulerM

        public static void setRotateEulerM(float[] rm,
                           int rmOffset,
                           float x,
                           float y,
                           float z)
        Converts Euler angles to a rotation matrix
        Parameters:
        rm - returns the result
        rmOffset - index into rm where the result matrix starts
        x - angle of rotation, in degrees
        y - angle of rotation, in degrees
        z - angle of rotation, in degrees
      • setLookAtM

        public static void setLookAtM(float[] rm,
                      int rmOffset,
                      float eyeX,
                      float eyeY,
                      float eyeZ,
                      float centerX,
                      float centerY,
                      float centerZ,
                      float upX,
                      float upY,
                      float upZ)
        Define a viewing transformation in terms of an eye point, a center of view, and an up vector.
        Parameters:
        rm - returns the result
        rmOffset - index into rm where the result matrix starts
        eyeX - eye point X
        eyeY - eye point Y
        eyeZ - eye point Z
        centerX - center of view X
        centerY - center of view Y
        centerZ - center of view Z
        upX - up vector X
        upY - up vector Y
        upZ - up vector Z


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 29 / 158693771. Delta: 0.04898 с