Pixel.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002  *  Pixel.h
00003  *
00004  *  (C) 2006 AG Aktives Sehen <agas@uni-koblenz.de>
00005  *           Universitaet Koblenz-Landau
00006  *
00007  * $Id: Pixel.h 44313 2011-04-06 22:46:28Z agas $
00008  *******************************************************************************/
00009 
00010 #ifndef PIXEL_H
00011 #define PIXEL_H
00012 
00013 #include "Point2D.h"
00014 #include <vector>
00015 
00020 class Pixel {
00021 
00022   public:
00023 
00024     inline Pixel( int x = 0, int y = 0) { m_X = x; m_Y = y; };
00025     inline ~Pixel() {};
00026 
00027     inline int x() const { return m_X; }
00028     inline int y() const { return m_Y; }
00029 
00030     inline void setX( int x ) { m_X = x; }
00031     inline void setY( int y ) { m_Y = y; }
00032 
00033     inline bool operator ==( Pixel& rhs ) { return ( m_X == rhs.m_X ) && ( m_Y == rhs.m_Y ); }
00034     inline bool operator !=( Pixel& rhs ) { return ( m_X != rhs.m_X ) || ( m_Y != rhs.m_Y ); }
00035     inline Pixel operator *( float rhs ) { return Pixel( m_X * rhs, m_Y * rhs ); }
00036     inline Pixel operator /( float rhs ) { return Pixel( m_X / rhs, m_Y / rhs ); }
00037 
00038     inline Point2D toPoint2D() { return Point2D( m_X, m_Y ); }
00039     
00040     inline std::vector<Point2D> vertices()
00041     {
00042       std::vector<Point2D> result(5);
00043       result[0]=Point2D( m_X-0.5, m_Y-0.5 );
00044       result[1]=Point2D( m_X+0.5, m_Y-0.5 );
00045       result[2]=Point2D( m_X+0.5, m_Y+0.5 );
00046       result[3]=Point2D( m_X-0.5, m_Y+0.5 );
00047       result[4]=result[0];
00048       return result;
00049     }
00050 
00051   private:
00052 
00053     int m_X;
00054     int m_Y;
00055 
00056 };
00057 
00058 
00059 #endif


robbie_architecture
Author(s): Viktor Seib
autogenerated on Mon Oct 6 2014 02:53:09