corner.h

Go to the documentation of this file.
00001 //
00002 // corner (element) property
00003 // stumeikle Sun May 12 20:31:50 2002
00004 //
00005 //
00006 
00007 #ifndef CORNER_H
00008 #define CORNER_H
00009 
00010 #include <boost/numeric/ublas/vector.hpp>
00011 #include <boost/shared_ptr.hpp>
00012 #include "angle.h"
00013 #include "prop.h"
00014 
00015 namespace mimas {
00016 
00026 class corner : public prop
00027 {
00028    public:
00029    typedef boost::numeric::ublas::vector< double > Vector;
00030     private:
00031    Vector centre;   
00032   double    strength; 
00033   angle   orientation;  
00034 
00035     public:
00036   void  setPosition( double x, double y) { centre(0) = x; centre(1) = y; }
00037   void  setPosition( const Vector &m )  { centre = m; }
00038   void  setStrength( double s )   { strength = s; }
00039   void  setContrast( double s )   { strength = s; }
00040   void  setOrientation( angle a )    { orientation = a; }
00041   const Vector &getPosition() { return centre; }
00042   double  getContrast()     { return strength; }
00043 
00044   corner(void) : prop( corner_t ), centre( 2 ) {}
00045 
00046   virtual void draw( image< rgba< unsigned char > > &output,
00047                       int i, int j, bool c)
00048   {
00049       int s;
00050       if (!c)
00051     s = 255;
00052       else
00053       {
00054     s = (int)(strength);
00055     if (s>255) s=255;
00056       }
00057 
00058       output.setPixel( i-1,j-1, rgba< unsigned char >(0,s,0) );
00059       output.setPixel( i,j-1, rgba< unsigned char >(0,s,0) );
00060       output.setPixel( i+1,j-1, rgba< unsigned char >(0,s,0) );
00061       output.setPixel( i-1,j, rgba< unsigned char >(0,s,0) );
00062       output.setPixel( i+1,j, rgba< unsigned char >(0,s,0) );
00063       output.setPixel( i-1,j+1, rgba< unsigned char >(0,s,0) );
00064       output.setPixel( i,j+1, rgba< unsigned char >(0,s,0) );
00065       output.setPixel( i+1,j+1, rgba< unsigned char >(0,s,0) );
00066 
00067   }
00068 
00069 };
00070 
00071 typedef boost::shared_ptr< corner > corner_ptr;
00072 
00073 };
00074 
00075 #endif

[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:16 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...