Example usage for com.badlogic.gdx.math Matrix4 M10

List of usage examples for com.badlogic.gdx.math Matrix4 M10

Introduction

In this page you can find the example usage for com.badlogic.gdx.math Matrix4 M10.

Prototype

int M10

To view the source code for com.badlogic.gdx.math Matrix4 M10.

Click Source Link

Document

YX: Typically the sine of the angle when rotated on the Z axis.

Usage

From source file:CB_UI_Base.graphics.GL_Matrix.java

License:Open Source License

@Override
public void mapPoints(float[] src) {

    float[] dst = new float[src.length];

    for (int i = 0; i * 2 < src.length; i++) {

        int j = i * 2;

        float x = src[j] * matrix4.val[Matrix4.M00] + src[j + 1] * matrix4.val[Matrix4.M01]
                + matrix4.val[Matrix4.M03];
        float y = src[j] * matrix4.val[Matrix4.M10] + src[j + 1] * matrix4.val[Matrix4.M11]
                + matrix4.val[Matrix4.M13];

        dst[j] = x;//from   ww  w . j  ava  2  s .c om
        dst[j + 1] = y;

    }

    System.arraycopy(dst, 0, src, 0, src.length);

}

From source file:CB_UI_Base.graphics.GL_Matrix.java

License:Open Source License

@Override
public void setValues(float[] fs) {

    matrix4.val[Matrix4.M00] = fs[0];
    matrix4.val[Matrix4.M01] = fs[1];
    matrix4.val[Matrix4.M03] = fs[2];
    matrix4.val[Matrix4.M10] = fs[3];
    matrix4.val[Matrix4.M11] = fs[4];
    matrix4.val[Matrix4.M13] = fs[5];
    matrix4.val[Matrix4.M20] = fs[6];
    matrix4.val[Matrix4.M21] = fs[7];
    matrix4.val[Matrix4.M22] = fs[8];

}

From source file:CB_UI_Base.graphics.GL_Matrix.java

License:Open Source License

@Override
public void preRotate(Float angle, Float px, Float py) {

    // ## native android ##
    // const SkScalar oneMinusCosV = 1 - cosV;
    ///* ww w.  j  a va2  s  .c  om*/
    // fMat[kMScaleX] = cosV;
    // fMat[kMSkewX] = -sinV;
    // fMat[kMTransX] = sdot(sinV, py, oneMinusCosV, px);
    //
    // fMat[kMSkewY] = sinV;
    // fMat[kMScaleY] = cosV;
    // fMat[kMTransY] = sdot(-sinV, px, oneMinusCosV, py);
    //
    // fMat[kMPersp0] = fMat[kMPersp1] = 0;
    // fMat[kMPersp2] = 1;

    Matrix4 m = new Matrix4();
    m.rotate(0, 0, 1, angle);
    float oneMinusCosV = 1 - m.val[Matrix4.M00];
    float sinV = m.val[Matrix4.M10];
    m.val[Matrix4.M03] = sdot(sinV, py, oneMinusCosV, px);
    m.val[Matrix4.M13] = sdot(-sinV, px, oneMinusCosV, py);

    this.matrix4.mul(m);
}

From source file:CB_UI_Base.graphics.GL_Matrix.java

License:Open Source License

@Override
public void getValues(float[] mValues) {
    mValues[0] = matrix4.val[Matrix4.M00];
    mValues[1] = matrix4.val[Matrix4.M01];
    mValues[2] = matrix4.val[Matrix4.M03];
    mValues[3] = matrix4.val[Matrix4.M10];
    mValues[4] = matrix4.val[Matrix4.M11];
    mValues[5] = matrix4.val[Matrix4.M13];
    mValues[6] = matrix4.val[Matrix4.M20];
    mValues[7] = matrix4.val[Matrix4.M21];
    mValues[8] = matrix4.val[Matrix4.M22];
}

From source file:CB_UI_Base.graphics.GL_Matrix.java

License:Open Source License

@Override
public String toString() {
    return "[" + this.matrix4.val[Matrix4.M00] + "|" + this.matrix4.val[Matrix4.M01] + "|"
            + this.matrix4.val[Matrix4.M03] + "]\n" + "[" + this.matrix4.val[Matrix4.M10] + "|"
            + this.matrix4.val[Matrix4.M11] + "|" + this.matrix4.val[Matrix4.M13] + "]\n" + "["
            + this.matrix4.val[Matrix4.M20] + "|" + this.matrix4.val[Matrix4.M21] + "|"
            + this.matrix4.val[Matrix4.M22] + "]";
}

From source file:CB_UI_Base.graphics.GL_Matrix.java

License:Open Source License

public static void MapPoints(float[] values, Matrix4 matrix4) {
    int index = 0;
    while (index < values.length) {
        float x0 = values[index] * matrix4.val[Matrix4.M00] + values[index + 1] * matrix4.val[Matrix4.M01]
                + matrix4.val[Matrix4.M03];
        float y0 = values[index] * matrix4.val[Matrix4.M10] + values[index + 1] * matrix4.val[Matrix4.M11]
                + matrix4.val[Matrix4.M13];

        values[index] = x0;/*  ww  w .  j a  va 2s .  c  o m*/
        values[index + 1] = y0;

        index += 2;
    }
}

From source file:CB_UI_Base.graphics.GL_Matrix.java

License:Open Source License

public static void MapPoint(float x, float y, Matrix4 matrix4, float[] mapedPoint) {
    mapedPoint[0] = x * matrix4.val[Matrix4.M00] + y * matrix4.val[Matrix4.M01] + matrix4.val[Matrix4.M03];
    mapedPoint[1] = x * matrix4.val[Matrix4.M10] + y * matrix4.val[Matrix4.M11] + matrix4.val[Matrix4.M13];
}

From source file:gaia.cu9.ari.gaiaorbit.util.g3d.MeshBuilder2.java

License:Apache License

@Override
public void arrow(float x1, float y1, float z1, float x2, float y2, float z2, float capLength,
        float stemThickness, int divisions) {
    Vector3 begin = tmp(x1, y1, z1), end = tmp(x2, y2, z2);
    float length = begin.dst(end);
    float coneHeight = length * capLength;
    float coneDiameter = 2 * (float) (coneHeight * Math.sqrt(1f / 3));
    float stemLength = length - coneHeight;
    float stemDiameter = coneDiameter * stemThickness;

    Vector3 up = tmp(end).sub(begin).nor();
    Vector3 forward = tmp(up).crs(Vector3.Z);
    if (forward.isZero())
        forward.set(Vector3.X);//from   w  w w  .ja  v a  2 s  . co  m
    forward.crs(up).nor();
    Vector3 left = tmp(up).crs(forward).nor();
    Vector3 direction = tmp(end).sub(begin).nor();

    // Matrices
    Matrix4 userTransform = getVertexTransform(tmp());
    Matrix4 transform = tmp();
    float[] val = transform.val;
    val[Matrix4.M00] = left.x;
    val[Matrix4.M01] = up.x;
    val[Matrix4.M02] = forward.x;
    val[Matrix4.M10] = left.y;
    val[Matrix4.M11] = up.y;
    val[Matrix4.M12] = forward.y;
    val[Matrix4.M20] = left.z;
    val[Matrix4.M21] = up.z;
    val[Matrix4.M22] = forward.z;
    Matrix4 temp = tmp();

    // Stem
    transform.setTranslation(tmp(direction).scl(stemLength / 2).add(x1, y1, z1));
    setVertexTransform(temp.set(transform).mul(userTransform));
    cylinder(stemDiameter, stemLength, stemDiameter, divisions);

    // Cap
    transform.setTranslation(tmp(direction).scl(stemLength).add(x1, y1, z1));
    setVertexTransform(temp.set(transform).mul(userTransform));
    cone(coneDiameter, coneHeight, coneDiameter, divisions);

    setVertexTransform(userTransform);
    cleanup();
}

From source file:ve.ucv.ciens.ccg.nxtar.graphics.CustomPerspectiveCamera.java

License:Apache License

public void setCustomARProjectionMatrix(final float focalPointX, final float focalPointY,
        final float cameraCenterX, final float cameraCenterY, final float near, final float far, final float w,
        final float h) {
    final float FAR_PLUS_NEAR = far + near;
    final float FAR_LESS_NEAR = far - near;

    projection.val[Matrix4.M00] = -2.0f * focalPointX / w;
    projection.val[Matrix4.M10] = 0.0f;
    projection.val[Matrix4.M20] = 0.0f;
    projection.val[Matrix4.M30] = 0.0f;

    projection.val[Matrix4.M01] = 0.0f;
    projection.val[Matrix4.M11] = 2.0f * focalPointY / h;
    projection.val[Matrix4.M21] = 0.0f;
    projection.val[Matrix4.M31] = 0.0f;

    projection.val[Matrix4.M02] = 2.0f * cameraCenterX / w - 1.0f;
    projection.val[Matrix4.M12] = 2.0f * cameraCenterY / h - 1.0f;
    projection.val[Matrix4.M22] = -FAR_PLUS_NEAR / FAR_LESS_NEAR;
    projection.val[Matrix4.M32] = -1.0f;

    projection.val[Matrix4.M03] = 0.0f;
    projection.val[Matrix4.M13] = 0.0f;
    projection.val[Matrix4.M23] = -2.0f * far * near / FAR_LESS_NEAR;
    projection.val[Matrix4.M33] = 0.0f;
}

From source file:ve.ucv.ciens.ccg.nxtar.systems.GeometrySystem.java

License:Apache License

private void applyWorldTransform(ModelInstance model, GeometryComponent geometry) {
    translationMatrix.setToTranslation(geometry.position);

    rotationMatrix.val[Matrix4.M00] = geometry.rotation.val[0];
    rotationMatrix.val[Matrix4.M10] = geometry.rotation.val[1];
    rotationMatrix.val[Matrix4.M20] = geometry.rotation.val[2];
    rotationMatrix.val[Matrix4.M30] = 0;

    rotationMatrix.val[Matrix4.M01] = geometry.rotation.val[3];
    rotationMatrix.val[Matrix4.M11] = geometry.rotation.val[4];
    rotationMatrix.val[Matrix4.M21] = geometry.rotation.val[5];
    rotationMatrix.val[Matrix4.M31] = 0;

    rotationMatrix.val[Matrix4.M02] = geometry.rotation.val[6];
    rotationMatrix.val[Matrix4.M12] = geometry.rotation.val[7];
    rotationMatrix.val[Matrix4.M22] = geometry.rotation.val[8];
    rotationMatrix.val[Matrix4.M32] = 0;

    rotationMatrix.val[Matrix4.M03] = 0;
    rotationMatrix.val[Matrix4.M13] = 0;
    rotationMatrix.val[Matrix4.M23] = 0;
    rotationMatrix.val[Matrix4.M33] = 1;

    scalingMatrix.setToScaling(geometry.scaling);

    model.transform.idt().mul(translationMatrix).mul(rotationMatrix).mul(scalingMatrix);
    model.calculateTransforms();//from  ww  w .jav  a  2  s  .  c  om
}