#395 Snap Intersection occasionally fails

2.1
open-remind
engine (33)
5
2013-12-27
2013-02-26
No

on a empty drawing create 2 circles with radius 13: first on any place, second on command line with "@0,-7.7777" (both have exactly same x-value !).
Now try to "snap Intersection" on the 2 intersection points: nothing will snap.
try out: "move and rotate" these 2 circles together to a new place: snap happens.
a second "move and rotate" with same angle, but other sign: snap don't happen.
Save this in a file, close and reopen: maybe, that snap happens on all intersection points, but sometime not.
This behaviour is not 100% reproducible.
It also occurs on arcs.
I assume a bug in "LC_Quadratic::getIntersection(qf1,qf2)", but i don't understand this mathematic simsalabim.
Please, can one of the experts remove this bug?
Till recently i used a clone from LC1 for my daily work, and so i couldn't detect this bug earlier. In LC1 "getIntersection" was much more simpel, but it worked without such bugs.

Discussion

  • Dongxu Li

    Dongxu Li - 2013-03-03

    fixed in master branch, commit: 0afddee..56aec4c

    This is a tolerance issue.

    This particular example resulted in a very wild quartic equation, and relatively large tolerance required to verify the roots found from quartic.

    The current solution considers the tolerance relative to DBL_EPSILON compared with maximum of terms in the polynomial.

    The similar improvement may be required for other equation solvers.

    Please report all test cases when intersection is not found, so I can improve the current equation solver.

    Dongxu Li

     
  • Dongxu Li

    Dongxu Li - 2013-03-03
    • assigned_to: nobody --> dongxuli
    • status: open --> open-fixed
     
  • Dietmar Kuehn

    Dietmar Kuehn - 2013-03-05

    Hi Dongxu,
    i think, your work was on the wrong place: i tested on many different pairs of circles, with some std::cout.
    in rs_math.cpp:449 "double discriminant" was <0 in all pairs without snapping. Thereby RS_Math::quarticSolverFull() return "roots(0,0.)". I'm not a mathematic guru, and don't find the reason.
    As a makeshift i switched to the old LC1 code. It seems to work without this strange bug. See "https://github.com/DietmarK/LC2DK.git" commit from today 22e6e7c66c9dd70c5fa0086d790ba7885ead8378.

     
  • Dietmar Kuehn

    Dietmar Kuehn - 2013-03-05
    • status: open-fixed --> open
     
  • Dietmar Kuehn

    Dietmar Kuehn - 2013-03-06

    Hi Dongxu,
    a little fix for my last comment: "double discriminant" is in rs_math.cpp:434 (i had added some std::cout...).
    In my opinion we had to check for special cases like equal x-values in RS_Information::getIntersection(..) before the call to LC_Quadratic::getIntersection(qf1,qf2). It seems, LC_Quadratic::getIntersection is not able to handle such cases without errors (or fixme and prove the opposite).
    Today i tested intersections ellipse-ellipse and ellipse-circle, all with same x-values for center-point: same results: found not all intersections, and if it occurs, it need a very small distance to the intersection point for snapping. This distance depends on the angle, from where the mouse nears. i hope this helps.

     
  • Dongxu Li

    Dongxu Li - 2013-05-21

    Hi Dietmar,

    can you provide a test case here?

    I want to fix this before 2.0-rc1

    Thanks,

    Dongxu

     
  • Dongxu Li

    Dongxu Li - 2013-12-27
    • status: open --> open-remind
    • Group: master branch --> 2.1
     

Log in to post a comment.