@Test public void testGetClosestEdge4() { T polygon = createEmptyConvexPolygon2D(); assertTrue(polygon.getClosestEdgeCopy(new Point2D()) == null); }
@Test public void testGetClosestEdge2() { Point2D vertex1 = new Point2D(2.0, 2.0); Point2D vertex2 = new Point2D(3.0, 3.0); T polygon = createEmptyConvexPolygon2D(); polygon.addVertex(vertex1); polygon.addVertex(vertex2); polygon.update(); LineSegment2D edge1 = new LineSegment2D(vertex1, vertex2); Point2D point1 = new Point2D(0.5, 0.1); EuclidGeometryTestTools.assertLineSegment2DGeometricallyEquals(edge1, polygon.getClosestEdgeCopy(point1), EPSILON); Point2D point2 = new Point2D(4.0, 4.0); EuclidGeometryTestTools.assertLineSegment2DGeometricallyEquals(edge1, polygon.getClosestEdgeCopy(point2), EPSILON); Point2D point3 = new Point2D(1.0, 1.0); EuclidGeometryTestTools.assertLineSegment2DGeometricallyEquals(edge1, polygon.getClosestEdgeCopy(point3), EPSILON); }
EuclidGeometryTestTools.assertLineSegment2DGeometricallyEquals(edge4, polygon.getClosestEdgeCopy(point1), EPSILON); EuclidGeometryTestTools.assertLineSegment2DGeometricallyEquals(edge1, polygon.getClosestEdgeCopy(point2), EPSILON); EuclidGeometryTestTools.assertLineSegment2DGeometricallyEquals(edge2, polygon.getClosestEdgeCopy(point3), EPSILON); EuclidGeometryTestTools.assertLineSegment2DGeometricallyEquals(edge2, polygon.getClosestEdgeCopy(point4), EPSILON); EuclidGeometryTestTools.assertLineSegment2DGeometricallyEquals(edge2, polygon.getClosestEdgeCopy(point5), EPSILON); EuclidGeometryTestTools.assertLineSegment2DGeometricallyEquals(edge3, polygon.getClosestEdgeCopy(point6), EPSILON); EuclidGeometryTestTools.assertLineSegment2DGeometricallyEquals(edge1, polygon.getClosestEdgeCopy(point7), EPSILON);
@Test public void testGetClosestEdge3() { T polygon = createEmptyConvexPolygon2D(); polygon.addVertex(new Point2D()); polygon.update(); assertTrue(polygon.getClosestEdgeCopy(new Point2D()) == null); }
LineSegment2DBasics closestEdge = polygon.getClosestEdgeCopy(point);