Пример #1
0
        public PathGeometry ClosedFit(List <Point> input, bool inputMayContainRepeats, double cornerThreshold, double distanceTolerance, bool onlyCubics)
        {
            if (input.Count < 3)
            {
                throw new ArgumentException(ExceptionStringTable.InputCollectionMustContainAtLeastThreePoints, "input");
            }
            PathGeometry       path = this.OpenFit(input, inputMayContainRepeats, cornerThreshold, distanceTolerance, onlyCubics);
            PathGeometryEditor pathGeometryEditor = new PathGeometryEditor(path);
            PathFigureEditor   pathFigureEditor   = new PathFigureEditor(path.Figures[0]);

            if (onlyCubics)
            {
                pathFigureEditor.CloseWithCubicBezier();
                this.figure = path.Figures[0];
                this.SetupCollinearHandlesConstraint(0, false);
            }
            else
            {
                pathFigureEditor.CloseWithLineSegment();
            }
            return(path);
        }