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