contrib/brl/bbas/bvgl/bvgl_triangle_interpolation_iterator.h
Go to the documentation of this file.
00001 #ifndef bvgl_triangle_interpolation_iterator_h_
00002 #define bvgl_triangle_interpolation_iterator_h_
00003 //:
00004 // \file
00005 #include <vcl_vector.h>
00006 
00007 #include <vgl/vgl_region_scan_iterator.h>
00008 #include <vgl/vgl_triangle_scan_iterator.h>
00009 
00010 template<class T>
00011 class bvgl_triangle_interpolation_iterator : public vgl_region_scan_iterator
00012 {
00013  public:
00014   //: constructor
00015   bvgl_triangle_interpolation_iterator(double *verts_x, double *verts_y, T *values, unsigned int v0 = 0, unsigned int v1 = 1, unsigned int v2 = 2);
00016 
00017   //: Resets the scan iterator to before the first scan line
00018   //  After calling this function, next() needs to be called before
00019   //  startx() and endx() form a valid scan line.
00020   virtual void reset();
00021 
00022   //: Tries to move to the next scan line.
00023   //  Returns false if there are no more scan lines.
00024   virtual bool next();
00025 
00026   //: y-coordinate of the current scan line.
00027   virtual int  scany() const;
00028 
00029   //: Returns starting x-value of the current scan line.
00030   //  startx() should be smaller than endx(), unless the scan line is empty
00031   virtual int  startx() const;
00032 
00033   //: Returns ending x-value of the current scan line.
00034   //  endx() should be larger than startx(), unless the scan line is empty
00035   virtual int  endx() const;
00036 
00037   //: returns the interpolated value at location x in the current scanline
00038   T value_at(int x);
00039 
00040  protected:
00041 
00042   vgl_triangle_scan_iterator<double> tri_it_;
00043 
00044   double s0_;
00045   double s1_;
00046   double s2_;
00047 };
00048 
00049 #endif