コード例 #1
0
        /// <summary>
        /// 找到线圈南侧的点
        /// </summary>
        /// <returns></returns>
        public static List <Vector2d> SourthVertices(this Polygon2d polygon2d)
        {
            if (polygon2d.IsClockwise) // 为true则是顺时针,
            {
                polygon2d.Reverse();   // 强制所有线圈为逆时针方向
            }

            // 1 找到线圈点集的最左、最右,同时偏下的角点
            Vector2d leftDownPoint  = polygon2d.MaxLeftMaxDownPoint();
            Vector2d rightDownPoint = polygon2d.MaxRightMaxDownPoint();

            // 2 基于点进行重新排序
            List <Vector2d> path_Vector2d = polygon2d.ReSortPolygon2dByPoint(leftDownPoint).Vertices.ToList();

            int leftDownIndex  = path_Vector2d.IndexOf(leftDownPoint);
            int rightDownIndex = path_Vector2d.IndexOf(rightDownPoint);

            int length = rightDownIndex - leftDownIndex + 1;

            return(path_Vector2d.GetRange(leftDownIndex, length));
        }