use of au.gov.asd.tac.constellation.utilities.graphics.Vector3f in project constellation by constellation-app.
the class BoundingBoxNGTest method testZero.
/**
* Can zero the primary verticies in a BoundingBox.
*/
@Test
public void testZero() {
final BoundingBox bb = new BoundingBox();
bb.set(new Vector3f(MIN), new Vector3f(MAX), new Vector3f(MIN2), new Vector3f(MAX2));
bb.zero();
assertEquals(bb.getMin().toString(), String.format("3f[%f,%f,%f]", -MINIMUM_SIZE, -MINIMUM_SIZE, -MINIMUM_SIZE));
assertEquals(bb.getMax().toString(), String.format("3f[%f,%f,%f]", MINIMUM_SIZE, MINIMUM_SIZE, MINIMUM_SIZE));
}
use of au.gov.asd.tac.constellation.utilities.graphics.Vector3f in project constellation by constellation-app.
the class CameraUtilitiesNGTest method testSetRotationCentre.
/**
* Can set the rotation centre of a Camera.
*/
@Test
public void testSetRotationCentre() {
final Camera c = new Camera(CAMERA);
CameraUtilities.setRotationCentre(c, new Vector3f(V10));
assertEquals(c.lookAtRotation.toString(), V10.toString());
}
use of au.gov.asd.tac.constellation.utilities.graphics.Vector3f in project constellation by constellation-app.
the class CameraUtilitiesNGTest method testMoveEyeToOrigin.
/**
* Can move the Camera eye to the origin point.
*/
@Test
public void testMoveEyeToOrigin() {
final Camera c = new Camera();
c.lookAtCentre.set(new Vector3f(112.946351F, 3.484323F, 99.185F));
c.lookAtEye.set(new Vector3f(70.66574F, 35.118F, 1.84154F));
CameraUtilities.moveEyeToOrigin(c);
assertEquals(c.lookAtEye.toString(), ZERO_VECTOR.toString());
assertEquals(c.lookAtCentre.toString(), new Vector3f(0.381789F, -0.285649F, 0.879001F).toString());
}
use of au.gov.asd.tac.constellation.utilities.graphics.Vector3f in project constellation by constellation-app.
the class CameraUtilitiesNGTest method testZoomToBoundingBox.
/**
* Can zoom so that the bounds of the supplied bounding box are visible.
*/
@Test
public void testZoomToBoundingBox() {
final Camera c = new Camera(CAMERA);
BoundingBox bb = new BoundingBox();
// empty box doesn't cause the Camera to zoom
CameraUtilities.zoomToBoundingBox(c, bb);
assertEquals(c.lookAtCentre.toString(), V1.toString());
assertEquals(c.lookAtEye.toString(), V2.toString());
assertEquals(c.lookAtUp.toString(), V3.toString());
assertEquals(c.lookAtRotation.toString(), V4.toString());
assertEquals(c.lookAtPreviousCentre.toString(), V6.toString());
assertEquals(c.lookAtPreviousEye.toString(), V5.toString());
assertEquals(c.lookAtPreviousUp.toString(), V7.toString());
assertEquals(c.lookAtPreviousRotation.toString(), V8.toString());
// zoom to a box
bb.set(new Vector3f(V2), new Vector3f(V17), new Vector3f(V4), new Vector3f(V15));
CameraUtilities.zoomToBoundingBox(c, bb);
assertEquals(c.lookAtCentre.toString(), new Vector3f(9.600006F, 9.699982F, 9.800049F).toString());
assertEquals(c.lookAtEye.toString(), new Vector3f(193.235336F, 193.335327F, 193.435394F).toString());
assertEquals(c.lookAtUp.toString(), V3.toString());
assertEquals(c.lookAtRotation.toString(), new Vector3f(9.600006F, 9.699982F, 9.800049F).toString());
assertEquals(c.lookAtPreviousCentre.toString(), V1.toString());
assertEquals(c.lookAtPreviousEye.toString(), V2.toString());
assertEquals(c.lookAtPreviousUp.toString(), V3.toString());
assertEquals(c.lookAtPreviousRotation.toString(), V4.toString());
}
use of au.gov.asd.tac.constellation.utilities.graphics.Vector3f in project constellation by constellation-app.
the class Graphics3DUtilitiesNGTest method testProject.
/**
* Can project a position to the viewing plane.
*/
@Test
public void testProject() {
final Vector4f v = new Vector4f();
assertTrue(Graphics3DUtilities.project(new Vector3f(V3_1), copyMatrix(M1), new int[] { 7, 3, 4, 14 }, v));
assertEquals(v.toString(), new Vector4f(10.976173F, 16.944405F, 0.998015F, 1158.400024F).toString());
}
Aggregations