Methods Summary |
---|
public float | get(int x, int y)Returns the value for a given row and column
return mMat[x*2 + y];
|
public float[] | getArray()Return a reference to the internal array representing matrix
values. Modifying this array will also change the matrix
return mMat;
|
public void | load(android.support.v8.renderscript.Matrix2f src)Sets the values of the matrix to those of the parameter
System.arraycopy(src.getArray(), 0, mMat, 0, mMat.length);
|
public void | loadIdentity()Sets the matrix values to identity
mMat[0] = 1;
mMat[1] = 0;
mMat[2] = 0;
mMat[3] = 1;
|
public void | loadMultiply(android.support.v8.renderscript.Matrix2f lhs, android.support.v8.renderscript.Matrix2f rhs)Sets current values to be the result of multiplying two given
matrices
for (int i=0 ; i<2 ; i++) {
float ri0 = 0;
float ri1 = 0;
for (int j=0 ; j<2 ; j++) {
float rhs_ij = rhs.get(i,j);
ri0 += lhs.get(j,0) * rhs_ij;
ri1 += lhs.get(j,1) * rhs_ij;
}
set(i,0, ri0);
set(i,1, ri1);
}
|
public void | loadRotate(float rot)Sets current values to be a rotation matrix of given angle
float c, s;
rot *= (float)(java.lang.Math.PI / 180.0f);
c = (float)java.lang.Math.cos(rot);
s = (float)java.lang.Math.sin(rot);
mMat[0] = c;
mMat[1] = -s;
mMat[2] = s;
mMat[3] = c;
|
public void | loadScale(float x, float y)Sets current values to be a scale matrix of given dimensions
loadIdentity();
mMat[0] = x;
mMat[3] = y;
|
public void | multiply(android.support.v8.renderscript.Matrix2f rhs)Post-multiplies the current matrix by a given parameter
Matrix2f tmp = new Matrix2f();
tmp.loadMultiply(this, rhs);
load(tmp);
|
public void | rotate(float rot)Modifies the current matrix by post-multiplying it with a
rotation matrix of given angle
Matrix2f tmp = new Matrix2f();
tmp.loadRotate(rot);
multiply(tmp);
|
public void | scale(float x, float y)Modifies the current matrix by post-multiplying it with a
scale matrix of given dimensions
Matrix2f tmp = new Matrix2f();
tmp.loadScale(x, y);
multiply(tmp);
|
public void | set(int x, int y, float v)Sets the value for a given row and column
mMat[x*2 + y] = v;
|
public void | transpose()Sets the current matrix to its transpose
float temp = mMat[1];
mMat[1] = mMat[2];
mMat[2] = temp;
|