[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
沒有留言:
張貼留言