Menu

#202 Spurious edge introduced when clipping open path

*
open
nobody
None
1
2021-10-11
2021-02-11
Anonymous
No

Hi Angus,

I'm not sure if there is interest in doing maintenance on ClipperLib, I can't help but notice there seem to be a number of unresolved geometry processing bugs. If there is interest though, here is an issue I encountered:

ClipperLib::Path a_ = {
        {1, 1},
        {2, 1},
        {2, 0},
        {4, 4},
};
ClipperLib::Path b_ = {
        {3, 0},
        {3, 3},
        {0, 3},
        {0, 0}
};
ClipperLib::Clipper c;
c.AddPath(a_, ClipperLib::ptSubject, false);
c.AddPath(b_, ClipperLib::ptClip, true);
ClipperLib::PolyTree solution;
c.Execute(ClipperLib::ctIntersection, solution, ClipperLib::pftNonZero, ClipperLib::pftNonZero);
ClipperLib::Paths solution_;
ClipperLib::PolyTreeToPaths(solution, solution_);
for (auto &e : solution_[0]) {
    auto s1 = std::to_string(e.X);
    auto s2 = std::to_string(e.Y);
    printf("%s, %s\n", s1.c_str(), s2.c_str());
}

This prints an unexpected additional edge between 1,1 and 2,0. I couldn't tell if it was related to the skip edge or not, I found that the 1,1 <-> 2,1 edge would still be reversed even if it wasn't adjacent to the skip edge. I tried to fix it, but was eventually stuck while trying to undertand the reason ProcessBounds was reversing the edge. (Maybe it shouldn't be carrying the path direction across the skip edge? That sounds reasonable, but I'm just grasping here.)

And let it not go unsaid: Thank you for ClipperLib, it has been amazingly useful to me.

Have a nice day!
-nmr

Discussion

  • nmr nmr

    nmr nmr - 2021-02-11

    Just commenting here now that I'm logged in, in order to subscribe to ticket.

     
  • Anonymous

    Anonymous - 2021-06-15

    This is the same issue as in https://sourceforge.net/p/polyclipping/bugs/183/, there one edge in the open path solution seems to be flipped.

     
    👍
    1
  • Angus Johnson

    Angus Johnson - 2021-06-18

    Thanks, for the feedback, and your patience 😁.
    I've just checked this and can confirm there is a bug there.
    Hopefully I'll have a fix for it in the next few days.

     
  • nmr nmr

    nmr nmr - 2021-10-11

    Just curious whether you would be interested in a contract for a weeks worth of ClipperLib bug fixing? Feel free to ping me at nathan at acmeaom dot cee oh em.

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB