Ellipses start to make everything more complex.
As I mentioned last week, I had to use my first numerical approximation within pantograph for ellipses. First, for the distance between a point and the ellipse. I used the method described in this blog post.
This week I went deeper. I started to look at the methods to find the intersection between an ellipse and a circle (or an ellipse, it should use the same code). Using the base logic found here, but using eigenvalues of the companion matrix of the polynomial to find the roots.
In both cases exact method also exists, but from what I have read, the precision is not better (because of numerical errors propagating). The methods I used do not seem 100% great either.
There are also many approximation and numerical methods I could use. The clean approach would be to attack some heavy tests of which is the best, most precise method. I must admit that I am not sure, that, at this point, the value added with such a research project is worth it for pantograph at its current state. It could be a nice student project in numerical analysis.
But I feel like I want to have something for now and move on.
In any case, the images generated for the tests look cool!
Offsets of ellipses
I assumed that the offset of an ellipse was also an ellipse (as the offset of an arc of circle is also an arc of circle). But I was wrong - I will need to use an approximation for this as well.
As a first step, I probably will not support ellipses offsets at all, because they will need to be expressed as Bézier curves…