contrib/brl/bseg/brip/brip_line_generator.h
Go to the documentation of this file.
00001 #ifndef brip_line_generator_h
00002 #define brip_line_generator_h
00003 //:
00004 // \file
00005 // \brief A process for generating a digital line
00006 // \author J.L. Mundy
00007 // \date May 4, 2008
00008 //
00009 // \verbatim
00010 //  Modifications ported from TargetJr
00011 // \endverbatim
00012 //
00013 //  Incremental generation of a digital line, a series of pixels that
00014 //  lie on a line segment specified by (xs, ys)->(xe, ye).  The function
00015 //  returns true when each new pixel is generated.  When the line segment
00016 //  is completed the function returns false. The first call to the function
00017 //  should have init = true to signal the start of the generation process.
00018 //
00019 //  Usage is as follows:
00020 //   ...
00021 //   vil_image_view<unsigned short> img = resc.get_view();//some resource
00022 //   bool init = true;
00023 //   while (brip_line_generator::generate(init, xs, ys, xe, ye, x, y))
00024 //   {
00025 //     int xi = (int)x, yi = (int)y; //convert the pixel location to integer
00026 //     unsigned short val = img(xi, yi) //get a pixel value
00027 //        ....
00028 //   }
00029 //
00030 // -------------------------------------------------------------------------
00031 
00032 class brip_line_generator
00033 {
00034  public:
00035   static bool generate(bool& init, float xs, float ys,
00036                        float xe, float ye,
00037                        float& x, float& y);
00038  private:
00039   brip_line_generator();
00040 };
00041 
00042 #endif // brip_line_generator_h