Search in sources :

Example 26 with Vector3f

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));
}
Also used : Vector3f(au.gov.asd.tac.constellation.utilities.graphics.Vector3f) Test(org.testng.annotations.Test)

Example 27 with Vector3f

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());
}
Also used : Vector3f(au.gov.asd.tac.constellation.utilities.graphics.Vector3f) Test(org.testng.annotations.Test)

Example 28 with Vector3f

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());
}
Also used : Vector3f(au.gov.asd.tac.constellation.utilities.graphics.Vector3f) Test(org.testng.annotations.Test)

Example 29 with Vector3f

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());
}
Also used : Vector3f(au.gov.asd.tac.constellation.utilities.graphics.Vector3f) Test(org.testng.annotations.Test)

Example 30 with Vector3f

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());
}
Also used : Vector4f(au.gov.asd.tac.constellation.utilities.graphics.Vector4f) Vector3f(au.gov.asd.tac.constellation.utilities.graphics.Vector3f) Test(org.testng.annotations.Test)

Aggregations

Vector3f (au.gov.asd.tac.constellation.utilities.graphics.Vector3f)85 Test (org.testng.annotations.Test)32 Frame (au.gov.asd.tac.constellation.utilities.graphics.Frame)14 Matrix44f (au.gov.asd.tac.constellation.utilities.graphics.Matrix44f)14 Camera (au.gov.asd.tac.constellation.utilities.camera.Camera)10 Vector4f (au.gov.asd.tac.constellation.utilities.graphics.Vector4f)7 Matrix33f (au.gov.asd.tac.constellation.utilities.graphics.Matrix33f)6 Point (java.awt.Point)6 JsonNode (com.fasterxml.jackson.databind.JsonNode)4 BitSet (java.util.BitSet)4 GL3 (com.jogamp.opengl.GL3)3 SetBooleanValuesOperation (au.gov.asd.tac.constellation.graph.operations.SetBooleanValuesOperation)2 IOException (java.io.IOException)2 Graph (au.gov.asd.tac.constellation.graph.Graph)1 HitState (au.gov.asd.tac.constellation.graph.interaction.framework.HitState)1 CreateTransactionPlugin (au.gov.asd.tac.constellation.graph.interaction.plugins.draw.CreateTransactionPlugin)1 CreateVertexPlugin (au.gov.asd.tac.constellation.graph.interaction.plugins.draw.CreateVertexPlugin)1 BoxSelectionPlugin (au.gov.asd.tac.constellation.graph.interaction.plugins.select.BoxSelectionPlugin)1 FreeformSelectionPlugin (au.gov.asd.tac.constellation.graph.interaction.plugins.select.FreeformSelectionPlugin)1 PointSelectionPlugin (au.gov.asd.tac.constellation.graph.interaction.plugins.select.PointSelectionPlugin)1