To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Added in 24 Hours
Languages
Recent
Show all languages
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

Greiner–Hormann clipping algorithm

From Wikipedia, the free encyclopedia

The Greiner-Hormann algorithm is used in computer graphics for polygon clipping.[1] It performs better than the Vatti clipping algorithm, but cannot handle degeneracies.[2] It can process both self-intersecting and non-convex polygons. It can be trivially generalized to compute other Boolean operations on polygons, such as union and difference.

The algorithm is based on the definition of the "inside" of a polygon based on the winding number. It considers regions with odd winding number to be inside the polygon; this is known as the even–odd rule. It takes two lists of polygons as input.

In its original form, the algorithm is divided into three phases:

  • In the first phase, pairwise intersections between edges of the polygons are computed. Additional vertices are inserted into both polygons at the points of intersection; an intersection vertex holds a pointer to its counterpart in the other polygon.
  • In the second phase, each intersection is marked as either an entry intersection or an exit intersection. This is accomplished by evaluating the even–odd rule at the first vertex, which allows you to know whether the first vertex is inside or outside the other polygon. Then, following the polygon's borders, the intersections are marked with alternating flags (the next intersection after an entry intersection must be an exit intersection).
  • In the third phase, the result is generated. The algorithm starts at an unprocessed intersection and picks the direction of traversal based on the entry/exit flag: for an entry intersection it traverses forward, and for an exit intersection it traverses in reverse. Vertices are added to the result until the next intersection is found; the algorithm then switches to the corresponding intersection vertex in the other polygon and picks the traversal direction again using the same rule. If the next intersection has already been processed, the algorithm finishes the current component of the output and starts again from an unprocessed intersection. The output is complete when there are no more unprocessed intersections.

The algorithm is not restricted to polygons and can handle arbitrary parametric curves as segments, as long as there is a suitable pairwise intersection procedure.

A major shortcoming of the original Greiner–Hormann algorithm is the fact that it cannot handle degeneracies, such as common edges or intersections exactly at a vertex. The original paper suggests perturbing the vertices to remove them.

See also

References

  1. ^ Greiner, Günther; Kai Hormann (1998). "Efficient clipping of arbitrary polygons". ACM Transactions on Graphics. 17 (2): 71–83. doi:10.1145/274363.274364.
  2. ^ Ionel Daniel Stroe. "Efficient Clipping of Arbitrary Polygons". Retrieved 2014-05-17.

External links

This page was last edited on 13 August 2023, at 05:34
Basis of this page is in Wikipedia. Text is available under the CC BY-SA 3.0 Unported License. Non-text media are available under their specified licenses. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. WIKI 2 is an independent company and has no affiliation with Wikimedia Foundation.