Esempio n. 1
0
        internal static PointCollection ReducePointsUsingDPAlg(PointCollection totalPoints, double tolerance)
        {
            PointCollection reducedPoints = new PointCollection();

            if (totalPoints == null || totalPoints.Count < 3)
            {
                return(totalPoints);
            }

            SortedDictionary <int, Point> sortedPoints = new SortedDictionary <int, Point>();

            //List<int> indexes = new List<int>();

            ReducePointsRecursively(totalPoints, 0, totalPoints.Count - 1, tolerance, sortedPoints);

            reducedPoints.Concat <Point>(sortedPoints.Values);

            sortedPoints.Clear();

            return(reducedPoints);
        }