Beispiel #1
0
        /// <summary>
        /// Returns this Polygon as convex polygon.
        ///
        /// If this polygon is convex, a clone of it is returned.
        /// If this polygon is concave, the Graham's (1972) "points to convex hull" enhanched algorythm is used to generate a convex polygon hull.
        /// </summary>
        /// <returns></returns>
        public Polygon2 ToConvexPolygon()
        {
            var convexhull = ConvexHullBuilder.Convexhull(this.ToVertices().Distinct());

            var clone = this.Clone() as Polygon2;

            clone.Clear();
            clone.AddRange(convexhull.ToVertices());
            return(clone);
        }