public void IsInRing_ThrowsArgumentExceptionIfRingHasLessThen3Points() { Coordinate c = new Coordinate(0, 0); CoordinateList ring = new CoordinateList(new Coordinate[] { new Coordinate(0, 1), new Coordinate(1, 0) }); Euclidean2DLocator target = new Euclidean2DLocator(); Assert.Throws<ArgumentException>(() => target.IsInRing(c, ring)); }
public void IsInRing_ThrowsArgumentExceptionIfCoordinateListDoesNotRepresentRing() { Coordinate c = new Coordinate(0, 0); CoordinateList ring = new CoordinateList(new Coordinate[] { new Coordinate(0, 1), new Coordinate(1, 0), new Coordinate(1, 2) }); Euclidean2DLocator target = new Euclidean2DLocator(); Assert.Throws<ArgumentException>(() => target.IsInRing(c, ring)); }
public void IsInRing_ReturnsTrueIfPointIsInSimpleRing() { string wktRing = "linestring (-1 -1, 1 -1, 1 1, -1 1, -1 -1)"; LineString ring = WktReader.Parse<LineString>(wktRing); Coordinate c = new Coordinate(0.5, 0.5); Euclidean2DLocator target = new Euclidean2DLocator(); Assert.True(target.IsInRing(c, ring.Coordinates)); }
public void IsInRing_ReturnsTrueIfPointIsInConcaveRing() { string wktRing = "linestring (0 0, 2 0, 1 1, 1 2, 0 0)"; LineString ring = WktReader.Parse<LineString>(wktRing); Coordinate c = new Coordinate(1, 0.5); Euclidean2DLocator target = new Euclidean2DLocator(); Assert.True(target.IsInRing(c, ring.Coordinates)); }
public void IsInRing_ReturnsFalseIfPointIsOutsideRing() { string wktRing = "linestring (0 0, 2 0, 1 1, 1 2, 0 0)"; LineString ring = WktReader.Parse<LineString>(wktRing); Coordinate c = new Coordinate(3, 0); Euclidean2DLocator target = new Euclidean2DLocator(); Assert.False(target.IsInRing(c, ring.Coordinates)); }
public void IsInRing_ReturnsFalseIfPointIsInRingAndCYCoordinateIsSameAsVertexYCoordinate() { string wktRing = "linestring (-1 -1, 1 -1, 1 0.5, 1 1, -1 1, -1 -1)"; LineString ring = WktReader.Parse<LineString>(wktRing); Coordinate c = new Coordinate(-2, 0.5); Euclidean2DLocator target = new Euclidean2DLocator(); Assert.False(target.IsInRing(c, ring.Coordinates)); }