Login  Register

Re: cannot snap intersection of two inscribed ellipses

Posted by dxli on Oct 12, 2024; 1:38am
URL: https://forum.librecad.org/cannot-snap-intersection-of-two-inscribed-ellipses-tp5725436p5725437.html

Hi,

This is a major issue we would like to address, but technically, it's a quite difficult problem without using a topological layer.

In summary, we try to find tangent points as intersection. For example, given a circle and one line tangent to the circle. While it might be obvious to identify the tangent point as an intersection, CAD relies on solving the equations of the line and the circle to find common solutions.

When a line intersects with the circle, two solutions can be found, so intersections are found reliably.
When there's no intersection, no solution is found, and that's just  what is expected.
When they are tangential, the point is created when the solver should find exactly 1 solution. However, due to the topology of tangent curves, any small noise adding to the curves, they may become intersecting with at two points, or disconnected with a gap.

 Now, rerun the equation solver, the equations are still being solved, but as we do everything with floating points, with rounding errors,  i.e. noises. The system may find two solutions, one solution, or no solution at all. That's exactly the root cause of finding intersections appears to be random for the end user, as you observed. Without going into the details of equations, just imagine a circle and a tangent line of it, now, both the circle and the line have some uncertainty due to rounding errors, so  there are always some random noises added to both of them, in positions, radius, etc. then, you can pick 2 intersections, 1, or none.

Possible solutions:

1. Create a topology layer, so the system will remember coincidence and tangential relations;
2. actively find tangential points, and add them to intersections. We do have reliable ways to find tangent points, by using dual curves from projective geometry, so finding tangent lines becomes finding intersections for dual curves.

We do know what won't work, blindly increasing the precision level of equation solving. This is an issue at the conceptual level, not only at the implementation level.

Workaround: try to create tangent lines, and snap to end points instead of intersections.

Tonyeltigresa wrote
Hello all,

this seems to be a perennial problem, one which I feel may have a now forgotten solution.

I can't snap to the intersection of two inscribed ellipses. It's an intermittent problem, sometimes it works and sometimes it doesn't. For example I just went to make an example drawing to accompany this post and I could snap to the intersection of two inscribed ellipses in that drawing, but it does not work in the drawing I have linked below.

I don't know how to recreate the problem, but I've had it a few times since I started using LibreCAD.

Any help appreciated.

Link to an example .dxf file ->    https://drive.proton.me/urls/FH8GGYHE0G#mnGIFy2iXr3K

EDIT: so I've just opened the above drawing in LibreCAD running on top of Debian 12 and snap intersection works on the ellipses there, but it doesn't work on Windows 11. However, I have had this same problem in the past on Debian 12, so I don't know what specifically is different now I've tried on a different OS.