免責聲明

Disclaimer (免責聲明)
繼續閱覽代表您接受以上的免責聲明.
To continue reading means you accept the above disclaimer.

2010年3月14日 星期日

Even-odd and winding-number rules

"Even-odd" and "winding-number" rules to determine a point is inside/outside a polygon.

[Q] How to determine whether a point is inside a polygon or not?
[Q] How to determine whether a point is inside a region or not?
(supposed that the region is formed by a path composed of only line segments and Bezier curves)



[Comments] 0-outside, 1-inside
even-odd : even -> outside, odd -> inside
winding-number: 0 is even -> outside, 1 is odd -> inside

winding-number rule is usually prefixed by "nonzero" to represent that a point is inside the polygon if the winding number is nonzero.

Actually, even-odd can be reckoned a special case of winding-number rule when modulo 2 is applied to its counting metrics --
  • number of crossed edges (even-odd)
  • number of net crossed edges considering edge direction(winding-number rules)


[ref]
http://www.cs.berkeley.edu/~ddgarcia/cs184/r3/#02
http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html

沒有留言:

張貼留言