/// <summary> /// Determines the <see cref="NetTopologySuite.Geometries.Location"/> of a point in a ring. /// This method is an exemplar of how to use this class. /// </summary> /// <param name="p">The point to test</param> /// <param name="ring">An array of Coordinates forming a ring</param> /// <returns>The location of the point in the ring</returns> public static Location LocatePointInRing(Coordinate p, Coordinate[] ring) { var counter = new NonRobustRayCrossingCounter(p); for (int i = 1; i < ring.Length; i++) { var p1 = ring[i]; var p2 = ring[i - 1]; counter.CountSegment(p1, p2); if (counter.IsOnSegment) { return(counter.Location); } } return(counter.Location); }
/// <summary> /// Determines the <see cref="NetTopologySuite.Geometries.Location"/> of a point in a ring. /// </summary> /// <param name="p">The point to test</param> /// <param name="ring">A coordinate sequence forming a ring</param> /// <returns>The location of the point in the ring</returns> public static Location LocatePointInRing(Coordinate p, CoordinateSequence ring) { var counter = new NonRobustRayCrossingCounter(p); var p1 = new Coordinate(); var p2 = new Coordinate(); for (int i = 1; i < ring.Count; i++) { ring.GetCoordinate(i, p1); ring.GetCoordinate(i - 1, p2); counter.CountSegment(p1, p2); if (counter.IsOnSegment) { return(counter.Location); } } return(counter.Location); }