use of org.bboxdb.commons.math.BoundingBox in project bboxdb by jnidzwetzki.
the class TestBoundingBox method mergeBoxesWithWrongDimension2.
/**
* Merge two boxes with wrong dimension
*/
@Test(expected = IllegalArgumentException.class)
public void mergeBoxesWithWrongDimension2() {
final BoundingBox boundingBox1 = new BoundingBox(1d, 3d, 1d, 3d);
final BoundingBox boundingBox2 = new BoundingBox(1d, 4d, 1d, 4d);
final BoundingBox boundingBox3 = new BoundingBox(1d, 4d, 1d, 4d, 1d, 4d);
final BoundingBox boundingBox4 = new BoundingBox(-1d, 2d, -1d, 2d, -1d, 2d);
// Wrong dimensions
final BoundingBox boundingBoxResult5 = BoundingBox.getCoveringBox(boundingBox1, boundingBox2, boundingBox3, boundingBox4);
Assert.assertTrue(boundingBoxResult5 == null);
}
use of org.bboxdb.commons.math.BoundingBox in project bboxdb by jnidzwetzki.
the class TestBoundingBox method testIntersection6.
/**
* Test the intersection of two bounding boxes
*/
@Test(timeout = 60000)
public void testIntersection6() {
final BoundingBox boundingBox1 = new BoundingBox(1.0d, 2.0d, 1.0d, 2.0d);
final BoundingBox boundingBox2 = new BoundingBox(1.0d, 3.0d, 1.0d, 3.0d);
Assert.assertEquals(boundingBox1, boundingBox1.getIntersection(boundingBox2));
Assert.assertEquals(boundingBox1, boundingBox2.getIntersection(boundingBox1));
}
use of org.bboxdb.commons.math.BoundingBox in project bboxdb by jnidzwetzki.
the class TestBoundingBox method testMergeBoxes1.
/**
* Test merge on array
*/
@Test(timeout = 60000)
public void testMergeBoxes1() {
final BoundingBox boundingBox1 = new BoundingBox(1d, 2d, 1d, 1d);
final BoundingBox boundingBox2 = new BoundingBox(1d, 1.1d, 1d, 4d);
final BoundingBox resultBox = BoundingBox.getCoveringBox(boundingBox1, boundingBox2);
Assert.assertArrayEquals(new double[] { 1d, 2d, 1d, 4f }, resultBox.toDoubleArray(), EQUALS_DELTA);
}
use of org.bboxdb.commons.math.BoundingBox in project bboxdb by jnidzwetzki.
the class TestBoundingBox method testIntersection4.
/**
* Test the intersection of two bounding boxes
*/
@Test(timeout = 60000)
public void testIntersection4() {
final BoundingBox boundingBox1 = new BoundingBox(1d, 5d, 1d, 5d);
final BoundingBox boundingBox2 = new BoundingBox(2d, 6d, 2d, 6d);
final BoundingBox boundingBoxResult = new BoundingBox(2d, 5d, 2d, 5d);
Assert.assertEquals(boundingBoxResult, boundingBox1.getIntersection(boundingBox2));
Assert.assertEquals(boundingBoxResult, boundingBox2.getIntersection(boundingBox1));
}
use of org.bboxdb.commons.math.BoundingBox in project bboxdb by jnidzwetzki.
the class TestBoundingBox method testMergeBoxes4.
/**
* Test merge on array
*/
@Test(timeout = 60000)
public void testMergeBoxes4() {
final BoundingBox resultBox1 = BoundingBox.getCoveringBox();
Assert.assertEquals(BoundingBox.FULL_SPACE, resultBox1);
final BoundingBox resultBox2 = BoundingBox.getCoveringBox(BoundingBox.FULL_SPACE);
Assert.assertEquals(BoundingBox.FULL_SPACE, resultBox2);
final BoundingBox resultBox3 = BoundingBox.getCoveringBox(BoundingBox.FULL_SPACE, BoundingBox.FULL_SPACE);
Assert.assertEquals(BoundingBox.FULL_SPACE, resultBox3);
}
Aggregations