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());
}
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;
}
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;
}
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());
}
Aggregations