Search in sources :

Example 1 with Matrix2dBase

use of maspack.matrix.Matrix2dBase in project artisynth_core by artisynth.

the class GLSupport method transformToGLMatrix.

/**
 * Converts a 2D affine transform to a 4D matrix expected by opengl
 */
public static void transformToGLMatrix(double[] mat, AffineTransform2dBase T) {
    Matrix2dBase M = T.getMatrix();
    Vector2d p = T.getOffset();
    mat[0] = M.m00;
    mat[1] = M.m10;
    mat[2] = 0;
    mat[3] = 0;
    mat[4] = M.m01;
    mat[5] = M.m11;
    mat[6] = 01;
    mat[7] = 0;
    mat[8] = 0;
    mat[9] = 0;
    mat[10] = 0;
    mat[11] = 0;
    mat[12] = p.x;
    mat[13] = p.y;
    mat[14] = 0;
    mat[15] = 1;
}
Also used : Vector2d(maspack.matrix.Vector2d) Matrix2dBase(maspack.matrix.Matrix2dBase)

Example 2 with Matrix2dBase

use of maspack.matrix.Matrix2dBase in project artisynth_core by artisynth.

the class MatricesUBO method putMatrix.

public static void putMatrix(ByteBuffer buff, AffineTransform2dBase T) {
    Matrix2dBase M = T.getMatrix();
    Vector2d b = T.getOffset();
    buff.putFloat((float) M.m00);
    buff.putFloat((float) M.m10);
    buff.putFloat(0);
    buff.putFloat(0);
    buff.putFloat((float) M.m01);
    buff.putFloat((float) M.m11);
    buff.putFloat(0);
    buff.putFloat(0);
    buff.putFloat(0);
    buff.putFloat(0);
    buff.putFloat(0);
    buff.putFloat(0);
    buff.putFloat((float) b.x);
    buff.putFloat((float) b.y);
    buff.putFloat(0);
    buff.putFloat((float) 1);
}
Also used : Vector2d(maspack.matrix.Vector2d) Matrix2dBase(maspack.matrix.Matrix2dBase)

Aggregations

Matrix2dBase (maspack.matrix.Matrix2dBase)2 Vector2d (maspack.matrix.Vector2d)2