Пример #1
0
        private bool ShouldEnforceSmoothness(PathTangentAdorner pathTangentAdorner)
        {
            int              partIndex        = pathTangentAdorner.PartIndex;
            PathEditContext  pathEditContext  = new PathEditContext(pathTangentAdorner.FigureIndex, partIndex);
            PathFigureEditor pathFigureEditor = new PathFigureEditor(pathEditContext.GetPathFigure(this.pathEditorTarget.PathGeometry));
            Point            point1           = pathFigureEditor.GetPoint(pathEditContext.PartIndex);
            bool             flag             = false;

            if (pathFigureEditor.IsFirstCubicBezierHandle(partIndex))
            {
                if (pathFigureEditor.GetPointKind(partIndex - 1) == PathPointKind.Cubic)
                {
                    Point point2 = pathFigureEditor.GetPoint(partIndex - 1);
                    Point point3 = pathFigureEditor.GetPoint(partIndex - 2);
                    flag = VectorUtilities.HaveOppositeDirections(point1 - point2, point3 - point2);
                }
            }
            else if (pathFigureEditor.IsIndexValid(partIndex + 4) && pathFigureEditor.GetPointKind(partIndex + 4) == PathPointKind.Cubic)
            {
                Point point2 = pathFigureEditor.GetPoint(partIndex + 1);
                Point point3 = pathFigureEditor.GetPoint(partIndex + 2);
                flag = VectorUtilities.HaveOppositeDirections(point1 - point2, point3 - point2);
            }
            return(flag);
        }