use of org.bboxdb.commons.math.BoundingBox in project bboxdb by jnidzwetzki.
the class TestBoundingBox method testIntersection1.
/**
* Test the intersection of two bounding boxes
*/
@Test(timeout = 60000)
public void testIntersection1() {
final BoundingBox boundingBox = new BoundingBox(1d, 3d, 3d, 7d);
Assert.assertEquals(BoundingBox.FULL_SPACE, boundingBox.getIntersection(BoundingBox.FULL_SPACE));
Assert.assertEquals(BoundingBox.FULL_SPACE, BoundingBox.FULL_SPACE.getIntersection(boundingBox));
}
use of org.bboxdb.commons.math.BoundingBox in project bboxdb by jnidzwetzki.
the class TestBoundingBox method testIsFullyCovered1.
/**
* Test the is covered method
*/
@Test(timeout = 60000)
public void testIsFullyCovered1() {
final BoundingBox boundingBox1 = new BoundingBox(0d, 10d, 0d, 10d);
final BoundingBox boundingBox2 = new BoundingBox(1d, 5d, 1d, 5d);
final BoundingBox boundingBox3 = new BoundingBox(1d, 11d, 1d, 11d);
Assert.assertTrue(boundingBox1.isCovering(boundingBox1));
Assert.assertTrue(boundingBox1.isCovering(boundingBox2));
Assert.assertFalse(boundingBox1.isCovering(boundingBox3));
Assert.assertFalse(boundingBox2.isCovering(boundingBox1));
Assert.assertTrue(boundingBox2.isCovering(boundingBox2));
Assert.assertFalse(boundingBox2.isCovering(boundingBox3));
Assert.assertFalse(boundingBox3.isCovering(boundingBox1));
Assert.assertTrue(boundingBox3.isCovering(boundingBox2));
Assert.assertTrue(boundingBox3.isCovering(boundingBox3));
}
use of org.bboxdb.commons.math.BoundingBox in project bboxdb by jnidzwetzki.
the class TestBoundingBox method testBoundingBoxSplit2.
/**
* Test the split method
*/
@Test(expected = IllegalArgumentException.class)
public void testBoundingBoxSplit2() {
final BoundingBox boundingBox1 = new BoundingBox(1d, 3d, 3d, 7d);
boundingBox1.splitAndGetLeft(4d, 0, true);
}
use of org.bboxdb.commons.math.BoundingBox in project bboxdb by jnidzwetzki.
the class TestBoundingBox method testVolume.
/**
* Test the volume of the bounding box
*/
@Test(timeout = 60000)
public void testVolume() {
final BoundingBox boundingBox1 = new BoundingBox(0d, 1d, 0d, 1d);
final BoundingBox boundingBox2 = new BoundingBox(0d, 10d, 0d, 10d);
final BoundingBox boundingBox3 = new BoundingBox(-5d, 5d, -5d, 5d);
Assert.assertEquals(1.0, boundingBox1.getVolume(), EQUALS_DELTA);
Assert.assertEquals(100.0, boundingBox2.getVolume(), EQUALS_DELTA);
Assert.assertEquals(100.0, boundingBox3.getVolume(), EQUALS_DELTA);
}
use of org.bboxdb.commons.math.BoundingBox in project bboxdb by jnidzwetzki.
the class TestBoundingBox method testLowHigh.
/**
* Test the calculation of low and high values
*/
@Test(timeout = 60000)
public void testLowHigh() {
final BoundingBox bb1 = new BoundingBox(1d, 11d);
Assert.assertEquals(1d, bb1.getCoordinateLow(0), EQUALS_DELTA);
Assert.assertEquals(11d, bb1.getCoordinateHigh(0), EQUALS_DELTA);
final BoundingBox bb2 = new BoundingBox(1d, 11d, 10d, 60d);
Assert.assertEquals(1d, bb2.getCoordinateLow(0), EQUALS_DELTA);
Assert.assertEquals(11d, bb2.getCoordinateHigh(0), EQUALS_DELTA);
Assert.assertEquals(10d, bb2.getCoordinateLow(1), EQUALS_DELTA);
Assert.assertEquals(60d, bb2.getCoordinateHigh(1), EQUALS_DELTA);
}
Aggregations