PathGeometry pathGeometry = new PathGeometry(); // ... add some lines and curves to pathGeometry double fraction = 0.5; // get the point at half the length of the path PathFigure figure = pathGeometry.Figures.First(); Point point = figure.GetPointAtFractionLength(fraction, out Vector tangent); // now you can use the "point" and "tangent" variables as needed
double fraction = 0.25; // get the point at quarter the length of the path PathFigure figure = pathGeometry.Figures.Last(); Point point = figure.GetPointAtFractionLength(fraction); // now you can use the "point" variable as neededThis example retrieves the Point object that corresponds to the quarter length of the path. It only retrieves the point object and not the tangent vector. In conclusion, the GetPointAtFractionLength method of the System.Windows.Media.PathGeometry class is a handy method for getting the location and direction of a complex shape at specific points along its length. This class is a part of the Windows Presentation Foundation (WPF) package library in C#.