2

GetPointAtFractionLength

pathGeometry.GetPointAtFractionLength(progress, out point, out tangent);

GetPointAtFractionLength gives a point on the pathgeometry and a tangent at that point if factional length is given.

I have the point already but I don't have the (factional length)progress. Is there a method just to get the tangent to the pathgeometry at a given point on the pathgeometry?

Sam
  • 933
  • 5
  • 14
  • 26

2 Answers2

0

Have a look at this question: Getting length of a PathGeometry (lines) in C#/WPF

This question and its answers show a way to calculate the point by flattening the curve.

Community
  • 1
  • 1
Emond
  • 50,210
  • 11
  • 84
  • 115
0

You could use the Bisection method (Wikipedia article on Bisection) to find the fraction at which the output point is closest to your given point and then use the out tangent at that value. Depending upon the shape of your curve you could have local minima that could cause problems, so you may want to start with a linear search until you get close, and then use Bisection to find an accurate answer.

Doug Ferguson
  • 2,538
  • 2
  • 16
  • 23