Menu

Required a union operation over a group of polygons..

Ignorant
2021-12-18
2022-02-27
  • Ignorant

    Ignorant - 2021-12-18

    How does one do a union of polygon collections....in the minimal passes over the data sets...

     
  • Jay Tee

    Jay Tee - 2021-12-18

    Given that all your rings are wound in the same direction (e.g. outer rings anti-clockwise and holes clockwise), you could perform a union operation with your rings as subject polygon, an empty clip polygon, and a fill rule of NonZero.

     

    Last edit: Jay Tee 2021-12-18
  • Ignorant

    Ignorant - 2021-12-19

    Thank you ..Thank you...
    So there is a usage of NONZERO fill rules for my explorations....
    I tried with odd/even and got sore eyes...

     
  • Ignorant

    Ignorant - 2021-12-19

    But how do I orient my randomly generated Closed Contours ..They may be self intersecting ...No meaning of clockwise./anticlockwise

     

    Last edit: Ignorant 2021-12-20
  • Jay Tee

    Jay Tee - 2021-12-20

    Well, if your rings / contours are randomly generated, which rule do you apply to decide which parts are inside / outside? The EvenOdd rule? In that case, I don't understand how you want to union them.

     
    • Ignorant

      Ignorant - 2021-12-20

      Well, I am just playing with a odd even rule based old program.The
      output shows intersections.
      And I thought Doinga union might help.
      The union can be done over the filled regions in each polygon. no.?.

      On Mon, Dec 20, 2021 at 4:44 PM Jay Tee jay-tee@users.sourceforge.net
      wrote:

       

      Last edit: Ignorant 2022-02-27
  • Jay Tee

    Jay Tee - 2021-12-21

    Sorry, I don't understand what you are trying to achieve. Let's consider an example. I randomly generated some rings and filled them via the EvenOdd rule (see below). What do you expect the union to look like?

     
  • Ignorant

    Ignorant - 2021-12-22

    I want the image to be same if i add individual contours incrementally to previous result ..one contour at a step,Initial result contour can be any one of the input contours. ..Filled Area covered by the contours is what i require...?

     

    Last edit: Ignorant 2021-12-22
  • Jay Tee

    Jay Tee - 2021-12-22

    Okay, in that case, you can successively set your previous result (initially, an empty polygon) as subject, your new contour as clip (or vice versa) and execute a union operation with the EvenOdd rule for the new contour. You will need one complete iteration over all scanbeams (i.e. one run of Vatti's algorithm) per contour you add. In the general case, it won't become computationally "cheaper" than that . I think we already discussed the topic of "partial" invocations of the algorithm (i.e. starting at an arbitrary scanline), but I still don't see how to implement that in a robust manner.

     
  • Ignorant

    Ignorant - 2021-12-22

    Yes ..Thank you a lot for your explanation.
    Murtas method does work for even odd to start at arbitrary scan line and terminate also at a scan line above it...but holes at boundry scan Lines disappear though the non holes change accordingly..
    Angus clipper and Murta easily allow to terminate at any scan line for Even-odd.
    I have done that with clipper for odd even only. I have not tried with other windings.

     
  • Jay Tee

    Jay Tee - 2021-12-22

    You're welcome :) Yes, terminating at an arbitrary scanline should work if you artificially close the open outputs there (even with different fill rules), but starting in the middle is a problem.

     
    • Ignorant

      Ignorant - 2022-02-21

      Jay,
      I got hold of a original release announcement for the general polygon
      clipper..very old ..got it from wayback archives.
      It says multiple polygons are allowed on either side only if they are
      disjoint in the subject group and clip group. for gpc.
      In the XOR operation it shows some unexpected behaviour if edges within
      a beam are bundled.(Murta transform of edges).
      The XOR was introduced in the vatti family by MURTA with his Generic
      Polygon Clipper.
      I have edit his version 2.32 and 2.33(later withdrawn!) to get equivalent
      results with Angus Clipper which uses Murta Qudrants while extending to
      other
      windings.
      You had educated me that for oddeven windings only 2 codes are required
      for intersectedges in Angus Clipper .
      That is true for gpc without bundles...but fails in a very surprising way
      for MURTA bundles within a scan beam...
      what is your say on XOR,?

       

      Last edit: Ignorant 2022-02-27
  • Jay Tee

    Jay Tee - 2022-02-24

    Yes, I'm still sure this is correct, but only for the even-odd wind rule. In that case, every edge is contributing (= associated with an output polygon). Subsequently, there are only two possible constellations for intersecting edges (see attachments). Both are handled by pushing the intersection point to both outputs.

    I am not familiar with the definition of "Murta bundles", but I guess the term refers to coincident edges that are "bundled together" (?) ... This approach is not necessary for Vatti's Algorithm to work correctly as long as the sort function is stable and does not unexpectedly swap coincident edges without generating an intersection for them. And I don't think it accelerates the algorithm in the general case, but complicates it instead. Anyway, XOR is not affected by coincident edges at all, there are still only two cases.

     

    Last edit: Jay Tee 2022-02-24
    • Ignorant

      Ignorant - 2022-02-25
       

      Last edit: Ignorant 2022-02-27
    • Ignorant

      Ignorant - 2022-02-27

      Do I Understand that for the XOR operation all edges are HOT (i.e. have a attached output contour) only for odd even.?. I never played with other windings.

       
      • Angus Johnson

        Angus Johnson - 2022-02-27

        Do I Understand that for the XOR operation all edges are HOT

        Not necessarily. Yes, all edges will be HOT when using EvenOdd filling. But they won't be HOT when using NonZero filling and Abs(edge.WindCount) > 1;

         
  • Angus Johnson

    Angus Johnson - 2022-02-25

    Hi Ignorant. Once again, it would be really helpful if you stopped quoting previous messages in you reply posts. People can already see previous messages so you're just adding a lot of noise with this quoting.

     
  • Ignorant

    Ignorant - 2022-02-27

    Sorry, I dont know how to use gmail properly.I will be careful when i use the reply option.!

     
  • Angus Johnson

    Angus Johnson - 2022-02-27

    Thanks. 👍

     
MongoDB Logo MongoDB