#include <vgl_polygon_scan_iterator.h>
Inheritance diagram for vgl_polygon_scan_iterator< T >:

This class provides an iterator-style interface to polygon scan conversion. There are convenient constructors from vgl_polygon, and_ lists of floats. An auxiliary clipping window can be specified by the constructor argument, vgl_box_2d<T> win.
Concave Polygon Scan Conversion by Paul Heckbert from "Graphics Gems", Academic Press, 1990
Scan convert nvert-sided concave non-simple polygon with vertices at (point[i].x, point[i].y) for i in [0..nvert-1] within the window win by calling spanproc for each visible span of pixels. Polygon can be clockwise or counterclockwise. Algorithm does uniform point sampling at pixel centers. Inside-outside test done by Jordan's rule: a point is considered inside if an emanating ray intersects the polygon an odd number of times.
Note: The span limits, startx and endx, are closed intervals. That is, you can use the endpoints of the span as valid interior points. Also, the initial and final y scan lines returned by the iterator are interior to the polygon. The constructor argument, win, is a clipping window that is intersected with the polygonal region to determine the actual scanned area.
Example usage:
vgl_polygon_scan_iterator<float> psi(mypoints); psi.set_include_boundary(true); // optional flag, default is true for (psi.reset(); psi.next(); ) { int y = psi.scany(); for (int x = psi.startx(); x <= psi.endx(); ++x) .... }
Definition at line 57 of file vgl_polygon_scan_iterator.h.
Public Types | |
| typedef vgl_polygon< T >::point_t | Point2 |
Public Member Functions | |
| vgl_polygon_scan_iterator (vgl_polygon< T > const &face, bool boundaryp=true) | |
| Construct with a polygon and bool indicating whether boundary included. | |
| vgl_polygon_scan_iterator (vgl_polygon< T > const &face, bool boundaryp, vgl_box_2d< T > const &window) | |
| Construct with a polygon, bool indicating whether boundary included and window (area visible). | |
| ~vgl_polygon_scan_iterator () | |
| Destructor. | |
| void | reset () |
| Resets iterator to first segment of first scan line. | |
| bool | next () |
| Moves iterator to next segment. | |
| int | scany () const |
| Returns current scan line. | |
| int | startx () const |
| Returns start of current span. | |
| int | endx () const |
| Returns end of current span. | |
| T | fstartx () const |
| Returns start of current span (floating point value). | |
| T | fendx () const |
| Returns end of current span (floating point value). | |
| T | fscany () const |
| Returns current scan line (floating point value). | |
| int | count () |
| Number of image points (= integer grid points) inside the region. | |
Private Member Functions | |
| T | get_x (vertind v) const |
| T | get_y (vertind v) const |
| Point2 | get_pt (vertind v) const |
| void | init () |
| void | delete_edge (vertind v) |
| void | insert_edge (vertind v) |
| void | get_next_vert (vertind v, vertind &next) |
| Returns the vertex following v in v's chain. | |
| void | get_prev_vert (vertind v, vertind &prev) |
| Returns the vertex preceding v in v's chain. | |
| void | display_chains () |
| void | display_crossedges () |
Private Attributes | |
| int | boundp |
| boolean indicating if boundary should be included or not | |
| int | xl |
| left bound of current span | |
| T | fxl |
| left bound of current span (floating point value) | |
| int | xr |
| right bound of current span | |
| T | fxr |
| right bound of current span (floating point value) | |
| int | k |
| current index of vertices ordered by increasing y | |
| int | y0 |
| bottommost scan line | |
| int | y1 |
| topmost scan line | |
| int | y |
| current scan line | |
| T | fy |
| floating point value of current scan line (i.e. T(y)) | |
| int | curcrossedge |
| crossedge marking start of next scan segment | |
| vgl_box_2d< T > | win |
| clipping window | |
| bool | have_window |
| vgl_polygon< T > | poly_ |
| the polygon | |
| vertind * | yverts |
| array of all vertices ordered by y coordinate | |
| crossedge * | crossedges |
| array of edges crossing current scan line | |
| int | numcrossedges |
| number of edges currently crossing scan line | |
| int | numverts |
| total number of vertices comprising face | |
Classes | |
| struct | crossedge |
| Describes an edge crossing the current scan line. More... | |
| struct | vertind |
| Vertex index - uniquely identifies a vertex in the array chains. More... | |
|
|||||
|
Definition at line 77 of file vgl_polygon_scan_iterator.h. |
|
||||||||||||||||
|
Construct with a polygon and bool indicating whether boundary included.
Definition at line 111 of file vgl_polygon_scan_iterator.txx. |
|
||||||||||||||||||||
|
Construct with a polygon, bool indicating whether boundary included and window (area visible).
Definition at line 124 of file vgl_polygon_scan_iterator.txx. |
|
|||||||||
|
Destructor.
Definition at line 101 of file vgl_polygon_scan_iterator.txx. |
|
|
Number of image points (= integer grid points) inside the region.
Definition at line 48 of file vgl_region_scan_iterator.h. |
|
||||||||||
|
Definition at line 211 of file vgl_polygon_scan_iterator.txx. |
|
|||||||||
|
Definition at line 420 of file vgl_polygon_scan_iterator.txx. |
|
|||||||||
|
Definition at line 441 of file vgl_polygon_scan_iterator.txx. |
|
|||||||||
|
Returns end of current span.
Implements vgl_region_scan_iterator. Definition at line 106 of file vgl_polygon_scan_iterator.h. |
|
|||||||||
|
Returns end of current span (floating point value).
Definition at line 112 of file vgl_polygon_scan_iterator.h. |
|
|||||||||
|
Returns current scan line (floating point value).
Definition at line 115 of file vgl_polygon_scan_iterator.h. |
|
|||||||||
|
Returns start of current span (floating point value).
Definition at line 109 of file vgl_polygon_scan_iterator.h. |
|
||||||||||||||||
|
Returns the vertex following v in v's chain. The vertex is returned through the parameter nextvert. I get a syntax error when I tried to return an object of type vertind. Compiler error says the default return type is int??? Definition at line 395 of file vgl_polygon_scan_iterator.txx. |
|
||||||||||||||||
|
Returns the vertex preceding v in v's chain. The vertex is returned through the parameter prevvert. I get a syntax error when I tried to return an object of type vertind. Compiler error says the default return type is int??? Definition at line 408 of file vgl_polygon_scan_iterator.txx. |
|
||||||||||
|
Definition at line 146 of file vgl_polygon_scan_iterator.h. |
|
||||||||||
|
Definition at line 140 of file vgl_polygon_scan_iterator.h. |
|
||||||||||
|
Definition at line 143 of file vgl_polygon_scan_iterator.h. |
|
|||||||||
|
Definition at line 139 of file vgl_polygon_scan_iterator.txx. |
|
||||||||||
|
Definition at line 230 of file vgl_polygon_scan_iterator.txx. |
|
|||||||||
|
Moves iterator to next segment.
Implements vgl_region_scan_iterator. Definition at line 289 of file vgl_polygon_scan_iterator.txx. |
|
|||||||||
|
Resets iterator to first segment of first scan line.
Implements vgl_region_scan_iterator. Definition at line 260 of file vgl_polygon_scan_iterator.txx. |
|
|||||||||
|
Returns current scan line.
Implements vgl_region_scan_iterator. Definition at line 100 of file vgl_polygon_scan_iterator.h. |
|
|||||||||
|
Returns start of current span.
Implements vgl_region_scan_iterator. Definition at line 103 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
boolean indicating if boundary should be included or not
Definition at line 59 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
array of edges crossing current scan line
Definition at line 135 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
crossedge marking start of next scan segment
Definition at line 69 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
left bound of current span (floating point value)
Definition at line 61 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
right bound of current span (floating point value)
Definition at line 63 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
floating point value of current scan line (i.e. T(y))
Definition at line 68 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
Definition at line 71 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
current index of vertices ordered by increasing y
Definition at line 64 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
number of edges currently crossing scan line
Definition at line 136 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
total number of vertices comprising face
Definition at line 137 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
the polygon
Definition at line 73 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
clipping window
Definition at line 70 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
left bound of current span
Definition at line 60 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
right bound of current span
Definition at line 62 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
current scan line
Definition at line 67 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
bottommost scan line
Definition at line 65 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
topmost scan line
Definition at line 66 of file vgl_polygon_scan_iterator.h. |
|
|||||
|
array of all vertices ordered by y coordinate
Definition at line 134 of file vgl_polygon_scan_iterator.h. |
1.4.4