public void TwoPiecees_兩個多邊形僅Touch() { var coords1 = new List<Coordinate> { new Coordinate(1, 1), new Coordinate(2, 1), new Coordinate(2, 2), new Coordinate(1, 2), new Coordinate(1, 1) }; var p1 = new Polygon(coords1); var coords2 = new List<Coordinate> { new Coordinate(2, 1), new Coordinate(3, 1), new Coordinate(3, 2), new Coordinate(2, 2), new Coordinate(2, 1) }; var p2 = new Polygon(coords2); var merger = new MergerCustom(); var result = merger.TwoPieces(p1, p2, null, null); Assert.NotNull(result); Assert.AreEqual(2.0, result.Area, 0.00000001); }
public void ConvexHull_由兩條線段產生多邊形() { var coords1 = new List<Coordinate> { new Coordinate(1, 1), new Coordinate(1, 2) }; var line1 = new LineString(coords1); var coords2 = new List<Coordinate> { new Coordinate(2, 1), new Coordinate(2, 2) }; var line2 = new LineString(coords2); var merger = new MergerCustom(); var result = merger.GetConvexHull(line1, line2); Assert.NotNull(result); Assert.AreEqual(1.0, result.Area, 0.00000001); }