Fill a polygonal face with interior scan lines. More...
#include <vgl_fwd.h>

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... | |
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. More... | |
| 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). More... | |
| ~vgl_polygon_scan_iterator () override | |
| Destructor. More... | |
| void | reset () override |
| Resets iterator to first segment of first scan line. More... | |
| bool | next () override |
| Moves iterator to next segment. More... | |
| int | scany () const override |
| Returns current scan line. More... | |
| int | startx () const override |
| Returns start of current span. More... | |
| int | endx () const override |
| Returns end of current span. More... | |
| T | fstartx () const |
| Returns start of current span (floating point value). More... | |
| T | fendx () const |
| Returns end of current span (floating point value). More... | |
| T | fscany () const |
| Returns current scan line (floating point value). More... | |
| void | get_crossedge_vertices (int *&chainnum, int *&vertnum, int &numcrossedges) |
| int | count () |
| Number of image points (= integer grid points) inside the region. More... | |
Private Member Functions | |
| vgl_polygon_scan_iterator (const vgl_polygon_scan_iterator &)=delete | |
| vgl_polygon_scan_iterator & | operator= (const vgl_polygon_scan_iterator &)=delete |
| 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. More... | |
| void | get_prev_vert (vertind v, vertind &prev) |
| Returns the vertex preceding v in v's chain. More... | |
| void | display_chains () |
| void | display_crossedges () |
Private Attributes | |
| int | boundp |
| boolean indicating if boundary should be included or not More... | |
| int | xl |
| left bound of current span More... | |
| T | fxl |
| left bound of current span (floating point value) More... | |
| int | xr |
| right bound of current span More... | |
| T | fxr |
| right bound of current span (floating point value) More... | |
| int | k |
| current index of vertices ordered by increasing y More... | |
| int | y0 |
| bottommost scan line More... | |
| int | y1 |
| topmost scan line More... | |
| int | y |
| current scan line More... | |
| T | fy |
| floating point value of current scan line (i.e. T(y)) More... | |
| int | curcrossedge |
| crossedge marking start of next scan segment More... | |
| vgl_box_2d< T > | win |
| clipping window More... | |
| bool | have_window |
| vgl_polygon< T > | poly_ |
| the polygon More... | |
| vertind * | yverts |
| array of all vertices ordered by y coordinate More... | |
| crossedge * | crossedges |
| array of edges crossing current scan line More... | |
| int | numcrossedges |
| number of edges currently crossing scan line More... | |
| int | numverts |
| total number of vertices comprising face More... | |
Fill a polygonal face with interior scan lines.
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:
| typedef vgl_polygon<T>::point_t vgl_polygon_scan_iterator< T >::Point2 |
Definition at line 77 of file vgl_polygon_scan_iterator.h.
| vgl_polygon_scan_iterator< T >::vgl_polygon_scan_iterator | ( | vgl_polygon< T > const & | face, |
| bool | boundaryp = true |
||
| ) |
Construct with a polygon and bool indicating whether boundary included.
Definition at line 96 of file vgl_polygon_scan_iterator.hxx.
| vgl_polygon_scan_iterator< T >::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).
Definition at line 109 of file vgl_polygon_scan_iterator.hxx.
|
override |
Destructor.
Definition at line 86 of file vgl_polygon_scan_iterator.hxx.
|
privatedelete |
|
inlineinherited |
Number of image points (= integer grid points) inside the region.
Definition at line 48 of file vgl_region_scan_iterator.h.
|
private |
Definition at line 196 of file vgl_polygon_scan_iterator.hxx.
|
private |
Definition at line 423 of file vgl_polygon_scan_iterator.hxx.
|
private |
Definition at line 444 of file vgl_polygon_scan_iterator.hxx.
|
inlineoverridevirtual |
Returns end of current span.
Implements vgl_region_scan_iterator.
Definition at line 106 of file vgl_polygon_scan_iterator.h.
|
inline |
Returns end of current span (floating point value).
Definition at line 112 of file vgl_polygon_scan_iterator.h.
|
inline |
Returns current scan line (floating point value).
Definition at line 115 of file vgl_polygon_scan_iterator.h.
|
inline |
Returns start of current span (floating point value).
Definition at line 109 of file vgl_polygon_scan_iterator.h.
| void vgl_polygon_scan_iterator< T >::get_crossedge_vertices | ( | int *& | chainnum, |
| int *& | vertnum, | ||
| int & | numcrossedges | ||
| ) |
Definition at line 268 of file vgl_polygon_scan_iterator.hxx.
|
private |
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 398 of file vgl_polygon_scan_iterator.hxx.
|
private |
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 411 of file vgl_polygon_scan_iterator.hxx.
|
inlineprivate |
Definition at line 151 of file vgl_polygon_scan_iterator.h.
|
inlineprivate |
Definition at line 145 of file vgl_polygon_scan_iterator.h.
|
inlineprivate |
Definition at line 148 of file vgl_polygon_scan_iterator.h.
|
private |
Definition at line 124 of file vgl_polygon_scan_iterator.hxx.
|
private |
Definition at line 216 of file vgl_polygon_scan_iterator.hxx.
|
overridevirtual |
Moves iterator to next segment.
Implements vgl_region_scan_iterator.
Definition at line 289 of file vgl_polygon_scan_iterator.hxx.
|
privatedelete |
|
overridevirtual |
Resets iterator to first segment of first scan line.
Implements vgl_region_scan_iterator.
Definition at line 246 of file vgl_polygon_scan_iterator.hxx.
|
inlineoverridevirtual |
Returns current scan line.
Implements vgl_region_scan_iterator.
Definition at line 100 of file vgl_polygon_scan_iterator.h.
|
inlineoverridevirtual |
Returns start of current span.
Implements vgl_region_scan_iterator.
Definition at line 103 of file vgl_polygon_scan_iterator.h.
|
private |
boolean indicating if boundary should be included or not
Definition at line 59 of file vgl_polygon_scan_iterator.h.
|
private |
array of edges crossing current scan line
Definition at line 140 of file vgl_polygon_scan_iterator.h.
|
private |
crossedge marking start of next scan segment
Definition at line 69 of file vgl_polygon_scan_iterator.h.
|
private |
left bound of current span (floating point value)
Definition at line 61 of file vgl_polygon_scan_iterator.h.
|
private |
right bound of current span (floating point value)
Definition at line 63 of file vgl_polygon_scan_iterator.h.
|
private |
floating point value of current scan line (i.e. T(y))
Definition at line 68 of file vgl_polygon_scan_iterator.h.
|
private |
Definition at line 71 of file vgl_polygon_scan_iterator.h.
|
private |
current index of vertices ordered by increasing y
Definition at line 64 of file vgl_polygon_scan_iterator.h.
|
private |
number of edges currently crossing scan line
Definition at line 141 of file vgl_polygon_scan_iterator.h.
|
private |
total number of vertices comprising face
Definition at line 142 of file vgl_polygon_scan_iterator.h.
|
private |
the polygon
Definition at line 73 of file vgl_polygon_scan_iterator.h.
|
private |
clipping window
Definition at line 70 of file vgl_polygon_scan_iterator.h.
|
private |
left bound of current span
Definition at line 60 of file vgl_polygon_scan_iterator.h.
|
private |
right bound of current span
Definition at line 62 of file vgl_polygon_scan_iterator.h.
|
private |
current scan line
Definition at line 67 of file vgl_polygon_scan_iterator.h.
|
private |
bottommost scan line
Definition at line 65 of file vgl_polygon_scan_iterator.h.
|
private |
topmost scan line
Definition at line 66 of file vgl_polygon_scan_iterator.h.
|
private |
array of all vertices ordered by y coordinate
Definition at line 139 of file vgl_polygon_scan_iterator.h.
1.8.15