/// <summary> /// 找到线圈北侧的点 /// </summary> /// <returns></returns> public static List <Vector2d> NourthVertices(this Polygon2d polygon2d) { if (polygon2d.IsClockwise) // 为true则是顺时针, { polygon2d.Reverse(); // 强制所有线圈为逆时针方向 } // 1 找到线圈点集的最左、最右,同时偏下的角点 Vector2d leftUpPoint = polygon2d.MaxLeftMaxUpPoint(); Vector2d rightUpPoint = polygon2d.MaxRightMaxUpPoint(); // 2 基于点进行重新排序 排序后便于去点集的区间范围 List <Vector2d> path_Vector2d = polygon2d.ReSortPolygon2dByPoint(rightUpPoint).Vertices.ToList(); int leftUpIndex = path_Vector2d.IndexOf(leftUpPoint); int rightUpIndex = path_Vector2d.IndexOf(rightUpPoint); // 所有线圈遵循逆时针模式 int length = leftUpIndex - rightUpIndex + 1; return(path_Vector2d.GetRange(rightUpIndex, length)); }