/// <summary>
        /// We current have the following approaches:
        ///     - None: Takes the mask representation of the polygon and return the outer edge
        ///     - Small: Uses a simplistic 'code-book' approach to smoothing the outer edge of the polygon
        /// </summary>
        /// <param name="polygon">The input mask representation of the extracted polygon.</param>
        /// <param name="smoothingType">The smoothing type to use.</param>
        /// <returns>The smoothed polygon.</returns>
        public static PointF[] Smooth(InnerOuterPolygon polygon, ContourSmoothingType smoothingType = ContourSmoothingType.Small)
        {
            var result = SmoothAndMerge(
                polygon,
                (points, isCounterClockwise) => SmoothPoints(points, isCounterClockwise, smoothingType));

            return(ContourSimplifier.RemoveRedundantPoints(result));
        }
        private static PointF[] SmallSmoothPolygon(IReadOnlyList <PointInt> polygon, bool isCounterClockwise)
        {
            // The contour simplification code called below expects contours in a string format
            // describing a sequence of unit moves (left, right, straight). The ideal place to
            // compute such a string would be in the code for walking around the contour bounary.
            // But to facilitate early integration, we'll do this here for now.
            var perimeterPath  = ClockwisePointsToExternalPathWindowsPoints(polygon, isCounterClockwise, 0.0f);
            var perimeterPath_ = perimeterPath.Select(x => { return(new PointInt((int)x.X, (int)x.Y)); }).ToList();

            PointInt start, initialDirection;

            string turns;

            ConvertPerimeterPointsToTurnString(perimeterPath_, out start, out initialDirection, out turns);

            var simplified = ContourSimplifier.Simplify(start, initialDirection, turns);

            for (int i = 0; i < simplified.Length; i++)
            {
                simplified[i] = new PointF(simplified[i].X - 0.5f, simplified[i].Y - 0.5f);
            }

            return(simplified);
        }