vgl_triangle_scan_iterator.h
Go to the documentation of this file.
1 // This is core/vgl/vgl_triangle_scan_iterator.h
2 #ifndef vgl_triangle_scan_iterator_h_
3 #define vgl_triangle_scan_iterator_h_
4 //:
5 // \file
6 // \brief Optimized polygon scan iterator for triangles
7 // \author fsm
8 // \verbatim
9 // Modifications
10 // Nov.2003 - Peter Vanroose - made class vgl_triangle_scan_iterator templated
11 // \endverbatim
12 
14 
15 #define use_polygon_scan_iterator 0
16 
17 //: Optimized polygon scan iterator for triangles.
18 template <class T>
20 {
21  public:
22  //: Vertices of triangle
23  struct pt { T x; T y; } a, b, c;
24 
25 #if use_polygon_scan_iterator
28 #endif
29 
30  void reset() override;
31  bool next() override;
32  inline int scany() const override { return scany_; }
33  inline int startx() const override { return startx_; }
34  inline int endx() const override { return endx_; }
35 
36  private:
37  int scany_;
38  int startx_;
39  int endx_;
40 
41 #if use_polygon_scan_iterator
42  struct data_t;
43  data_t *data;
44 #else
45  int y0, y1;
46  int x0, x1;
47 
48  pt g; // centroid, for conditioning
49  T data[3][3];
50 #endif
51 };
52 
53 #define VGL_TRIANGLE_SCAN_ITERATOR_INSTANTIATE(T) extern "please include <vgl/vgl_triangle_scan_iterator.hxx> instead"
54 
55 #endif // vgl_triangle_scan_iterator_h_
int scany() const override
y-coordinate of the current scan line.
struct vgl_triangle_scan_iterator::pt b
struct vgl_triangle_scan_iterator::pt a
bool next() override
Tries to move to the next scan line.
struct vgl_triangle_scan_iterator::pt c
Optimized polygon scan iterator for triangles.
Definition: vgl_fwd.h:34
void reset() override
Resets the scan iterator to before the first scan line.
int endx() const override
Returns ending x-value of the current scan line.
int startx() const override
Returns starting x-value of the current scan line.
Abstract base class for iterating over the pixels in a region of an image.