Search in sources :

Example 31 with Matrix44f

use of au.gov.asd.tac.constellation.utilities.graphics.Matrix44f 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 32 with Matrix44f

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

the class Graphics3DUtilitiesNGTest method copyMatrix.

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

Example 33 with Matrix44f

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

the class AnaglyphCameraNGTest method copyMatrix.

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

Example 34 with Matrix44f

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

the class AnaglyphCameraNGTest method testApplyFrustum.

/**
 * Can apply either a left or a right frustum. Testing both left and right
 * methods in the same test case because they are almost identical. Creating
 * unit tests first to give assurance that a future refactor doesn't break
 * anything.
 */
@Test
public void testApplyFrustum() {
    final AnaglyphCamera sc = new AnaglyphCamera(F1, F2, F3, F4, F5, F6);
    // apply a left frustum
    final Matrix44f expected1 = new Matrix44f();
    expected1.setRow(M1_R1[0], M1_R1[1], M1_R1[2], M1_R1[3], 0);
    expected1.setRow(M1_R2[0], M1_R2[1], M1_R2[2], M1_R2[3], 1);
    expected1.setRow(M1_R3[0], M1_R3[1], M1_R3[2], M1_R3[3], 2);
    expected1.setRow(34996.41F, 30003.002F, 8168.77F, 7247.0312F, 3);
    assertEquals(sc.applyLeftFrustum(copyMatrix(M1)).toString(), expected1.toString());
    // using an equivalent matrix to apply a left frustum yields the same result
    assertEquals(sc.applyLeftFrustum(copyMatrix(M1)).toString(), expected1.toString());
    // apply a right frustum
    final Matrix44f expected2 = new Matrix44f();
    expected2.setRow(-6437.1655F, M1_R1[1], M1_R1[2], M1_R1[3], 0);
    expected2.setRow(-25310.898F, M1_R2[1], M1_R2[2], M1_R2[3], 1);
    expected2.setRow(-3630.2336F, M1_R3[1], M1_R3[2], M1_R3[3], 2);
    expected2.setRow(-7736.1377F, M1_R4[1], M1_R4[2], M1_R4[3], 3);
    assertEquals(sc.applyRightFrustum(copyMatrix(M1)).toString(), expected2.toString());
    // using an equivalent matrix to apply a right frustum yields the same result
    assertEquals(sc.applyRightFrustum(copyMatrix(M1)).toString(), expected2.toString());
}
Also used : Matrix44f(au.gov.asd.tac.constellation.utilities.graphics.Matrix44f) Test(org.testng.annotations.Test)

Aggregations

Matrix44f (au.gov.asd.tac.constellation.utilities.graphics.Matrix44f)34 Vector3f (au.gov.asd.tac.constellation.utilities.graphics.Vector3f)15 Matrix33f (au.gov.asd.tac.constellation.utilities.graphics.Matrix33f)6 GL3 (com.jogamp.opengl.GL3)6 Test (org.testng.annotations.Test)6 Frame (au.gov.asd.tac.constellation.utilities.graphics.Frame)5 Camera (au.gov.asd.tac.constellation.utilities.camera.Camera)4 BitSet (java.util.BitSet)4 Vector4f (au.gov.asd.tac.constellation.utilities.graphics.Vector4f)3 ByteBuffer (java.nio.ByteBuffer)3 FloatBuffer (java.nio.FloatBuffer)3 SetBooleanValuesOperation (au.gov.asd.tac.constellation.graph.operations.SetBooleanValuesOperation)2 Frustum (au.gov.asd.tac.constellation.utilities.graphics.Frustum)2 Point (java.awt.Point)2 DeveloperPreferenceKeys (au.gov.asd.tac.constellation.preferences.DeveloperPreferenceKeys)1 AnaglyphCamera (au.gov.asd.tac.constellation.utilities.camera.AnaglyphCamera)1 Graphics3DUtilities (au.gov.asd.tac.constellation.utilities.camera.Graphics3DUtilities)1 ConstellationColor (au.gov.asd.tac.constellation.utilities.color.ConstellationColor)1 InfoTextPanel (au.gov.asd.tac.constellation.utilities.gui.InfoTextPanel)1 FpsBatcher (au.gov.asd.tac.constellation.visual.opengl.renderer.batcher.FpsBatcher)1