/// <summary>
        /// Various preprocesses available to apply to point data.
        /// </summary>
        /// <param name="pts">List of points on the curve.</param>
        /// <param name="preprocessMode">Mode, if any, to apply as preprocessing.</param>
        /// <param name="linearDist">See CurvePreprocess.Linearize.</param>
        /// <param name="rdpError">See CurvePreprocess.RdpReduce</param>
        /// <returns></returns>
        public static List <Vector2> Preprocess(List <Vector2> pts, ePreprocessModes preprocessMode, float linearDist, float rdpError)
        {
            switch (preprocessMode)
            {
            case ePreprocessModes.NONE:             return(pts);

            case ePreprocessModes.LINEAR:   return(CurvePreprocess.Linearize(pts, linearDist));

            case ePreprocessModes.RDP:              return(CurvePreprocess.RdpReduce(pts, rdpError));

            default:                                                return(CurvePreprocess.RemoveDuplicates(pts));
            }
        }
Пример #2
0
        public static int Main(string[] args)
        {
            // Before we do anything, we want to call these to force them to be JITed. Ohterwise the first time they are called will give wildly different
            // performance results than the user expects. This only takes a few ms, so it won't slow down app startup that much.
            List <VECTOR> data = new List <VECTOR>(TestData.data);

            CurvePreprocess.Linearize(data, 8);
            List <VECTOR> reduced = CurvePreprocess.RdpReduce(data, 2);

            CurveFit.Fit(reduced, 8);

            // Okay, now run the app
            return(WpfMain.run <App>());
        }
Пример #3
0
        private static List <VECTOR> preprocess(List <VECTOR> pts, PreprocessModes ppMode, FLOAT linDist, FLOAT rdpError)
        {
            switch (ppMode)
            {
            case PreprocessModes.NONE:
                return(pts);

            case PreprocessModes.LINEAR:
                return(CurvePreprocess.Linearize(pts, linDist));

            case PreprocessModes.RDP:
                return(CurvePreprocess.RdpReduce(pts, rdpError));

            default:
                _log.error("Invalid PreprocessMode");
                return(CurvePreprocess.RemoveDuplicates(pts));
            }
        }