So, I am working with an ellipse on a drawing surface, and I need to know the shortest distance from the ellipse path (center of the line thickness is fine) to a given point.
I can do this with raw math, if I need to, since I know Major and Minor axis of the ellipse. As far as I can tell, this will be rather complex.
I was wondering if my view can calculate this for me?
I am using an EllipseGeometry and setting the axis. The EllipseGeometry is then handed to the path (Path.Data) and it gets drawn.
Any thoughts to know what the shortest distance to the path is?
Just to close the loop on this:
I found some C++ code that did this with math, and translated over to C#. I don’t know how it works, but it does.
Ultimately, I was looking to highlight an ellipse when the mouse got near it. I was able to accomplish this with a different approach as well (but stayed with the pure-math approach):
Create a second path with the same geometry and translation as the path I am showing, but with a much thicker StrokeThickness and an opacity of 0.1. Do some hit testing on the larger, opaque path.