Ok. Just implemented the square distance error function. It works more or less well. Meaning my implementation of tangent was as bad as the DeepSOIC's normal distance one. With the squared distance this is much better than my previous implementation. Still, if you for the tangent line to be vertical and then you change your mind and apply a horizontal constraint to it, the solver crashes (if you help it a little bit by moving it out of the full vertical, it converges to horizontal). Needs more testing. Probably still needs improvements.
Teaser:

- Ellipse19.png (92.69 KiB) Viewed 1308 times
Where can you find this?
https://github.com/abdullahtahiriyo/Fre ... master.git
79ec397..a5ee25b sketcher_ellipse2 -> sketcher_ellipse2
What how do we know you did it right?
Well you can check my math. By using sage I produce the C code of the calculations directly from the formulas, so if you check the math and it is ok, then the c code corresponding to them should be ok.
How can I check your math?
By installing sage from their web page or Ubuntu PPA, or using an online server. You can find this information previously on this thread.
The files of tangent and point on ellipse are attached to this post.
Probably Ulrich's PointOnObject can be improved by using the squared distance, as in this case.
If you can suggest any improvement, please do it.
Forum moderators, is there any chance that the extension sws is allowed? This extension is for the sage work sheets. If we continue exchanging math it might be useful...
Just if you are just curious, a sage notebook looks like this:

- sage.png (86.25 KiB) Viewed 1304 times