internal static bool IsClockwiseRing(com.epl.geometry.MultiPathImpl polygon, int iring)
        {
            int high_point_index = polygon.GetHighestPointIndex(iring);
            int path_start       = polygon.GetPathStart(iring);
            int path_end         = polygon.GetPathEnd(iring);

            com.epl.geometry.Point2D q = polygon.GetXY(high_point_index);
            com.epl.geometry.Point2D p;
            com.epl.geometry.Point2D r;
            if (high_point_index == path_start)
            {
                p = polygon.GetXY(path_end - 1);
                r = polygon.GetXY(path_start + 1);
            }
            else
            {
                if (high_point_index == path_end - 1)
                {
                    p = polygon.GetXY(high_point_index - 1);
                    r = polygon.GetXY(path_start);
                }
                else
                {
                    p = polygon.GetXY(high_point_index - 1);
                    r = polygon.GetXY(high_point_index + 1);
                }
            }
            int orientation = com.epl.geometry.Point2D.OrientationRobust(p, q, r);

            if (orientation == 0)
            {
                return(polygon.CalculateRingArea2D(iring) > 0.0);
            }
            return(orientation == -1);
        }