edgel.h

Go to the documentation of this file.
00001 //
00002 // edgel stuff
00003 // stumeikle Sun May 12 20:30:02 2002
00004 //
00005 //
00006 
00007 #ifndef EDGEL_H
00008 #define EDGEL_H
00009 
00010 #include <boost/numeric/ublas/vector.hpp>
00011 #include <boost/shared_ptr.hpp>
00012 #include "angle.h"
00013 #include "prop.h"
00014 #include "image_draw.h"
00015 
00016 namespace mimas {
00017   
00033 class edgel : public prop   
00034 {
00035     private:
00036    typedef boost::numeric::ublas::vector< double > Vector;
00037    Vector centre;   
00038    double strength; 
00039    angle orientation; 
00040 
00041     public:
00043   edgel(void) : prop( edgel_t ), centre( 2 ) {}
00044 
00045   //inspectors and modifiers
00046   void  setPosition( double x, double y) { centre(0) = x; centre(1) = y; }
00047   void  setStrength( double s )   { strength = s; }
00048   void  setContrast( double s )   { strength = s; }
00049   void  setOrientation( angle a )    { orientation = a; }
00050 
00051   const Vector &getPosition() const { return centre; }
00052   angle getOrientation()  { return orientation; }
00053   double    getStrength()   { return strength; }
00054   double    getContrast()   { return strength; }
00055 
00060   virtual void draw( image< rgba< unsigned char > >& output,
00061                       int i, int j, bool c )
00062   {
00063       double e1x,e1y,e2x,e2y;
00064       angle a = orientation;
00065 
00066       //should really check to see if the orientation was set
00067       //you could draw the orientation of the edgel by increasing
00068       //the '1's below to a higher value.
00069       e1x = centre(0) + cos(a)*1;
00070       e1y = centre(1) + sin(a)*1;
00071       a+=M_PI;
00072 
00073       e2x = centre(0) + cos(a)*1;
00074       e2y = centre(1) + sin(a)*1;
00075       drawLine(output, (int) e1x, (int) e1y, (int) e2x, (int) e2y,
00076                         rgba< unsigned char >( (int)255, 0, 0 ) );
00077   }
00078 };
00079 
00080 typedef boost::shared_ptr< edgel > edgel_ptr;
00081 
00082 };
00083 
00084 #endif
00085 

[GNU/Linux] [Qt] [Mesa] [STL] [Lapack] [Boost] [Magick++] [Xalan-C and Xerces-C] [doxygen] [graphviz] [FFTW] [popt] [xine] [Gnuplot] [gnu-arch] [gcc] [gstreamer] [autoconf/automake/make] [freshmeat.net] [opensource.org] [sourceforge.net] [MMVL]
mimas 2.1 - Copyright Mon Oct 30 11:31:17 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...