public static Point GetPoint(PathFigure pathFigure, int index, bool correspondingPoint)
        {
            if (index == 0)
            {
                return(pathFigure.StartPoint);
            }
            PathSegmentCollection segments = pathFigure.Segments;
            int segmentIndex;
            int segmentPointIndex;

            PathFigureUtilities.GetSegmentFromPointIndex(pathFigure, index, out segmentIndex, out segmentPointIndex);
            PathSegment segment = segments[segmentIndex];

            if (correspondingPoint && segment is BezierSegment)
            {
                if (segmentPointIndex == 1)
                {
                    segmentPointIndex = 2;
                }
                else if (segmentPointIndex == 0)
                {
                    if (segmentIndex == 0)
                    {
                        return(pathFigure.StartPoint);
                    }
                    if (index > 0)
                    {
                        PathFigureUtilities.GetSegmentFromPointIndex(pathFigure, index - 1, out segmentIndex, out segmentPointIndex);
                        segment = segments[segmentIndex];
                    }
                }
            }
            return(PathSegmentUtilities.GetPoint(segment, segmentPointIndex));
        }
 public static Point GetLastPoint(PathSegment segment)
 {
     if (PathSegmentUtilities.IsEmpty(segment))
     {
         throw new ArgumentException(ExceptionStringTable.CannotGetLastPointFromAnEmptySegment, "segment");
     }
     return(PathSegmentUtilities.GetPoint(segment, PathSegmentUtilities.GetPointCount(segment) - 1));
 }