use of org.opengis.geometry.TransfiniteSet in project geotoolkit by Geomatys.
the class IntersectionTest method testEdgeIntersection.
@Test
public void testEdgeIntersection() {
DirectPosition[] pointsA = new DirectPosition[4];
pointsA[0] = createDirectPosition(0.0, 0.0);
pointsA[1] = createDirectPosition(1.0, 0.0);
pointsA[2] = createDirectPosition(0.0, 1.0);
pointsA[3] = createDirectPosition(0.0, 0.0);
DirectPosition[] pointsB = new DirectPosition[4];
pointsB[0] = createDirectPosition(1.0, 0.0);
pointsB[1] = createDirectPosition(1.0, 1.0);
pointsB[2] = createDirectPosition(0.0, 1.0);
pointsB[3] = createDirectPosition(1.0, 0.0);
Surface sA = createSurface(pointsA);
assertEquals(0.5, sA.getArea(), 1.0e-8);
assertEquals(1.0 + 1.0 + Math.sqrt(2.0), sA.getPerimeter(), 0.0);
Surface sB = createSurface(pointsB);
assertEquals(0.5, sB.getArea(), 1.0e-8);
assertEquals(1.0 + 1.0 + Math.sqrt(2.0), sB.getPerimeter(), 0.0);
TransfiniteSet result = sA.intersection(sB);
assertTrue("result was a " + result.getClass().getSimpleName(), result instanceof CurveSegment);
CurveSegment curveResult = (CurveSegment) result;
assertEquals(0.0, curveResult.getStartParam(), 1.0e-8);
// TODO
// assertEquals(Math.sqrt(2.0), curveResult.getEndParam(), 1.0e-8);
}
Aggregations