Search in sources :

Example 6 with Vector4f

use of au.gov.asd.tac.constellation.utilities.graphics.Vector4f in project constellation by constellation-app.

the class LineDragger method getTranslation.

public Vector3f getTranslation(final Matrix44f mvpMatrix, final int[] viewport, final float dx, final float dy) {
    totaldx += dx;
    totaldy += dy;
    final Vector4f mpDelta = new Vector4f(mouseProjected.getX() + totaldx, mouseProjected.getY() - totaldy, mouseProjected.getZ(), mouseProjected.getW());
    final Vector3f muDelta = new Vector3f();
    Graphics3DUtilities.unproject(mpDelta, mvpMatrix, viewport, muDelta);
    return new Vector3f(muDelta.getX() - mouseUnprojected.getX(), muDelta.getY() - mouseUnprojected.getY(), muDelta.getZ() - mouseUnprojected.getZ());
}
Also used : Vector4f(au.gov.asd.tac.constellation.utilities.graphics.Vector4f) Vector3f(au.gov.asd.tac.constellation.utilities.graphics.Vector3f)

Example 7 with Vector4f

use of au.gov.asd.tac.constellation.utilities.graphics.Vector4f in project constellation by constellation-app.

the class FPSRenderable method calculateXProjectionScale.

private float calculateXProjectionScale(final int[] viewport) {
    // calculate the number of pixels a scene object of y-length 1 projects to.
    final Vector4f proj1 = new Vector4f();
    Graphics3DUtilities.project(ZERO_3F, IDENTITY_44F, viewport, proj1);
    final Vector4f proj2 = new Vector4f();
    final Vector3f unitPosition = new Vector3f(1, 0, 0);
    Graphics3DUtilities.project(unitPosition, IDENTITY_44F, viewport, proj2);
    final float xScale = proj2.getX() - proj1.getX();
    return (256.0F / 64) / xScale;
}
Also used : Vector4f(au.gov.asd.tac.constellation.utilities.graphics.Vector4f) Vector3f(au.gov.asd.tac.constellation.utilities.graphics.Vector3f)

Example 8 with Vector4f

use of au.gov.asd.tac.constellation.utilities.graphics.Vector4f in project constellation by constellation-app.

the class Graphics3DUtilitiesNGTest method testUnsuccessfulProject.

/**
 * Unsuccessful projection.
 */
@Test
public void testUnsuccessfulProject() {
    final Matrix44f zeroMatrix = new Matrix44f();
    for (int i = 0; i < 4; i++) {
        zeroMatrix.setRow(0, 0, 0, 0, i);
    }
    final Vector4f v = copyVector4f(V4_1);
    assertFalse(Graphics3DUtilities.project(new Vector3f(ZERO_V), zeroMatrix, new int[] { 0, 0, 0, 0 }, new Vector4f()));
    assertEquals(v.toString(), V4_1.toString());
}
Also used : Matrix44f(au.gov.asd.tac.constellation.utilities.graphics.Matrix44f) Vector4f(au.gov.asd.tac.constellation.utilities.graphics.Vector4f) Vector3f(au.gov.asd.tac.constellation.utilities.graphics.Vector3f) Test(org.testng.annotations.Test)

Example 9 with Vector4f

use of au.gov.asd.tac.constellation.utilities.graphics.Vector4f in project constellation by constellation-app.

the class Graphics3DUtilitiesNGTest method copyVector4f.

// convenience method to get a copy of a Vector4f, as it's clunky
private Vector4f copyVector4f(Vector4f v) {
    Vector4f ret = new Vector4f();
    ret.set(v);
    return ret;
}
Also used : Vector4f(au.gov.asd.tac.constellation.utilities.graphics.Vector4f)

Aggregations

Vector4f (au.gov.asd.tac.constellation.utilities.graphics.Vector4f)9 Vector3f (au.gov.asd.tac.constellation.utilities.graphics.Vector3f)7 Matrix44f (au.gov.asd.tac.constellation.utilities.graphics.Matrix44f)2 Test (org.testng.annotations.Test)2