/// <summary> /// Determines whether [is any point on segment and not ends] [the specified polyline]. /// </summary> /// <param name="polyline">The polyline.</param> /// <returns><c>true</c> if [is any point on segment and not ends] [the specified polyline]; otherwise, <c>false</c>.</returns> public static bool IsJoiningPointOnAnotherSegment(PolyLine polyline) { CartesianCoordinate firstPoint = polyline.FirstPoint(); CartesianCoordinate lastPoint = polyline.LastPoint(); for (int i = 1; i < polyline.CountSegments - 1; i++) { // Loop is skipping first and last segments if (polyline[i] is LineSegment) { LineSegment segment = (LineSegment)polyline[i]; if ((segment.IncludesCoordinate(firstPoint) && !PointIntersection.IsOnPoint(firstPoint, segment.I) && !PointIntersection.IsOnPoint(firstPoint, segment.J)) || (segment.IncludesCoordinate(lastPoint) && !PointIntersection.IsOnPoint(lastPoint, segment.I) && !PointIntersection.IsOnPoint(lastPoint, segment.J))) { return(true); } } } return(false); }
/// <summary> /// Determines whether [is closed shape]. /// </summary> /// <returns>System.Boolean.</returns> public static bool IsClosedShape(PolyLine polyline) { return(polyline.FirstPoint() == polyline.LastPoint()); }