#31 Varying position of polygons in results Array.

closed
nobody
None
5
2012-09-08
2012-02-29
Michael
No

Hi ,I am not sure its a bug but here is what I found ,If I do a difference test for two polys whereas the clip object is inside the subject (that is hole) sometimes it return the subject at the index =1 of the array and on other cases index=0. It goes that way in C++ 4.7 version

Discussion

  • Angus Johnson

    Angus Johnson - 2012-02-29

    Hi Michael. Could you please provide a simple example where the 'subject' (by which I presume you mean the outer contour of the solution) is at index 1 (and presumably the hole contour is at index 0).

     
  • Michael

    Michael - 2012-02-29

    What you see here is a result of test where the first set of points is the hole polygon which is contained inside the second set.The names I printed here in fact should be conversely .In the test I pass the second (smaller ) set as the subject and the bigger set (which is here marked as subject) I pass as the clip poly.So at the result the swap places in the array. It doesn' t happen btw ,if I test this hole poly against a simple rectangle...

    subject-----------------------------------------------
    Vector3D(-4, 49, 0)
    Vector3D(5, 49, 0)
    Vector3D(15, 45, 0)
    Vector3D(23, 39, 0)
    Vector3D(28, 30, 0)
    Vector3D(30, 20, 0)
    Vector3D(30, 19, 0)
    Vector3D(28, 9, 0)
    Vector3D(23, 0, 0)
    Vector3D(14, -5, 0)
    Vector3D(4, -9, 0)
    Vector3D(-5, -9, 0)
    Vector3D(-15, -5, 0)
    Vector3D(-23, 0, 0)
    Vector3D(-28, 9, 0)
    Vector3D(-30, 20, 0)
    Vector3D(-28, 30, 0)
    Vector3D(-23, 39, 0)
    Vector3D(-14, 45, 0)
    clip-----------------------------------------------
    Vector3D(-100, 200, 0)
    Vector3D(-100, -200, 0)
    Vector3D(-31, -200, 0)
    Vector3D(-60, -150, 0)
    Vector3D(-24, -89, 0)
    Vector3D(45, -89, 0)
    Vector3D(80, -150, 0)
    Vector3D(50, -200, 0)
    Vector3D(200, -200, 0)
    Vector3D(200, 200, 0)

     
  • Angus Johnson

    Angus Johnson - 2012-02-29

    Thanks Michael. I hope to look at this shortly but I'm currently working on another bug.

     
  • Michael

    Michael - 2012-03-01

    My bad. I haven't explained it well .Forget about the names I gave here to the two sets.Because those mean the places of returning sets.When you pass them into the clipper you should pass the second (clip set) as the subject and the bigger set as the clip which forms a contained hole as you already notices. And you will get what I mean. Then do the same but instead of my subject pass any simple rectangle set and you get polys in the result array swap places.

     
  • Angus Johnson

    Angus Johnson - 2012-03-01

    OK, I can now see what's troubling you, though it's not a bug. As stated in the documentation (see http://www.angusj.com/delphi/clipper/documentation/Docs/Units/ClipperLib/Classes/Clipper/Methods/Execute.htm) ... "The order that polygons are listed in the solution structure is undefined."
    If you want polygon holes explicitly contained by their owner polygons then you'll need to pass the ExPolygons structure to Clipper's overloaded Execute method.

     
  • Michael

    Michael - 2012-03-01

    Ok,no problem I found a way around.Good also to know that is not a bug :) Thanks for your fast response.

     


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks