Search in sources :

Example 81 with Vector3f

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

the class BoundingBoxNGTest method testAddVertex.

/**
 * Can add a vertex to a BoundingBox.
 */
@Test
public void testAddVertex() {
    final BoundingBox bb = new BoundingBox();
    bb.set(new Vector3f(MIN), new Vector3f(MAX), new Vector3f(MIN2), new Vector3f(MAX2));
    // Change all elements in the max vector
    bb.addVertex(BIGGER_FLOAT1, BIGGER_FLOAT2, BIGGER_FLOAT3);
    assertEquals(bb.getMin().toString(), MIN.toString());
    assertEquals(bb.getMax().toString(), String.format("3f[%f,%f,%f]", BIGGER_FLOAT1, BIGGER_FLOAT2, BIGGER_FLOAT3));
    // Change all elements in the min vector
    bb.set(new Vector3f(MIN), new Vector3f(MAX), new Vector3f(MIN2), new Vector3f(MAX2));
    bb.addVertex(SMALLER_FLOAT1, SMALLER_FLOAT2, SMALLER_FLOAT3);
    assertEquals(bb.getMin().toString(), String.format("3f[%f,%f,%f]", SMALLER_FLOAT1, SMALLER_FLOAT2, SMALLER_FLOAT3));
    assertEquals(bb.getMax().toString(), MAX.toString());
    // Change some elements in the max vector
    bb.set(new Vector3f(MIN), new Vector3f(MAX), new Vector3f(MIN2), new Vector3f(MAX2));
    bb.addVertex(BIGISH_FLOAT, BIGISH_FLOAT, BIGISH_FLOAT);
    assertEquals(bb.getMin().toString(), MIN.toString());
    assertEquals(bb.getMax().toString(), String.format("3f[%f,%f,%f]", BIGISH_FLOAT, BIGISH_FLOAT, MAX.getZ()));
    // Change some elements in the min vector
    bb.set(new Vector3f(MIN), new Vector3f(MAX), new Vector3f(MIN2), new Vector3f(MAX2));
    bb.addVertex(SMALLISH_FLOAT, SMALLISH_FLOAT, SMALLISH_FLOAT);
    assertEquals(bb.getMin().toString(), String.format("3f[%f,%f,%f]", MIN.getX(), MIN.getY(), SMALLISH_FLOAT));
    assertEquals(bb.getMax().toString(), MAX.toString());
}
Also used : Vector3f(au.gov.asd.tac.constellation.utilities.graphics.Vector3f) Test(org.testng.annotations.Test)

Example 82 with Vector3f

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

the class BoundingBoxNGTest method testReset.

/**
 * Can reset a BoundingBox to the min and max of the float datatype.
 */
@Test
public void testReset() {
    final BoundingBox bb = new BoundingBox();
    bb.set(new Vector3f(MIN), new Vector3f(MAX), new Vector3f(MIN2), new Vector3f(MAX2));
    bb.resetMinMax();
    assertEquals(bb.getMin().toString(), MIN_EXTREME.toString());
    assertEquals(bb.getMax().toString(), MAX_EXTREME.toString());
    assertEquals(bb.getMin2().toString(), MIN_EXTREME.toString());
    assertEquals(bb.getMax2().toString(), MAX_EXTREME.toString());
    assertFalse(bb.isEmpty());
}
Also used : Vector3f(au.gov.asd.tac.constellation.utilities.graphics.Vector3f) Test(org.testng.annotations.Test)

Example 83 with Vector3f

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

the class BoundingBoxNGTest method testSet.

/**
 * Can explicitly set the verticies in a BoundingBox.
 */
@Test
public void testSet() {
    final BoundingBox bb = new BoundingBox();
    bb.set(new Vector3f(MIN), new Vector3f(MAX), new Vector3f(MIN2), new Vector3f(MAX2));
    assertEquals(bb.getMin().toString(), MIN.toString());
    assertEquals(bb.getMax().toString(), MAX.toString());
    assertEquals(bb.getMin2().toString(), MIN2.toString());
    assertEquals(bb.getMax2().toString(), MAX2.toString());
    // Set verticies again and check that the change was applied.
    bb.set(new Vector3f(MIN2), new Vector3f(MAX2), new Vector3f(MIN), new Vector3f(MAX));
    assertEquals(bb.getMin().toString(), MIN2.toString());
    assertEquals(bb.getMax().toString(), MAX2.toString());
    assertEquals(bb.getMin2().toString(), MIN.toString());
    assertEquals(bb.getMax2().toString(), MAX.toString());
}
Also used : Vector3f(au.gov.asd.tac.constellation.utilities.graphics.Vector3f) Test(org.testng.annotations.Test)

Example 84 with Vector3f

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

the class BoundingBoxNGTest method testCopy.

/**
 * Can copy a BoundingBox.
 */
@Test
public void testCopy() {
    final BoundingBox bb = new BoundingBox();
    bb.set(new Vector3f(MIN), new Vector3f(MAX), new Vector3f(MIN2), new Vector3f(MAX2));
    final BoundingBox bb2 = bb.copy();
    assertEquals(bb2.getMin().toString(), MIN.toString());
    assertEquals(bb2.getMax().toString(), MAX.toString());
    assertEquals(bb2.getMin2().toString(), MIN2.toString());
    assertEquals(bb2.getMax2().toString(), MAX2.toString());
    assertFalse(bb2.isEmpty());
}
Also used : Vector3f(au.gov.asd.tac.constellation.utilities.graphics.Vector3f) Test(org.testng.annotations.Test)

Example 85 with Vector3f

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

the class BoundingBoxNGTest method testZeroSecondary.

/**
 * Can zero the secondary verticies in a BoundingBox.
 */
@Test
public void testZeroSecondary() {
    final BoundingBox bb = new BoundingBox();
    bb.set(new Vector3f(MIN), new Vector3f(MAX), new Vector3f(MIN2), new Vector3f(MAX2));
    bb.zero2();
    assertEquals(bb.getMin2().toString(), bb.getMin().toString());
    assertEquals(bb.getMax2().toString(), bb.getMax().toString());
}
Also used : 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