Changeset 4496
- Timestamp:
- 08/04/04 16:57:28 (20 years ago)
- Location:
- trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/videospot.cpp
r4176 r4496 18 18 #include "videospot.h" 19 19 #include "stdlib.h" 20 #include "math.h" 20 21 21 22 VideoSpot::VideoSpot() … … 27 28 } 28 29 29 VideoSpot::VideoSpot( int p_iX, int p_iY)30 VideoSpot::VideoSpot( double p_dX, double p_dY, int p_iNumPixel ) 30 31 { 31 m_iNumPixel = 10; 32 m_iXSum = p_iX; 33 m_iYSum = p_iY; 34 m_iWSum = 1; 32 m_iNumPixel = p_iNumPixel; 33 m_iXSum = (int) rint(p_dX * 100.); 34 m_iYSum = (int) rint(p_dY * 100.); 35 m_iWSum = 100; 36 } 37 38 VideoSpot::VideoSpot( const VideoSpot& p_Spot ) 39 { 40 m_iNumPixel = p_Spot.m_iNumPixel; 41 m_iXSum = p_Spot.m_iXSum; 42 m_iYSum = p_Spot.m_iYSum; 43 m_iWSum = p_Spot.m_iWSum; 44 } 45 46 VideoSpot& VideoSpot::operator=( const VideoSpot& p_Spot ) 47 { 48 if (this == &p_Spot) return *this; // Gracefully handle self assignment 49 50 this->m_iNumPixel = p_Spot.m_iNumPixel; 51 this->m_iXSum = p_Spot.m_iXSum; 52 this->m_iYSum = p_Spot.m_iYSum; 53 this->m_iWSum = p_Spot.m_iWSum; 54 return *this; 35 55 } 36 56 … … 42 62 bool VideoSpot::contains( int p_iX, int p_iY ) 43 63 { 44 if( ( abs( p_iX - getX() ) < 10)64 if( ( fabs( p_iX - getX() ) < 10. ) 45 65 && 46 ( abs( p_iY - getY() ) < 10) )66 ( fabs( p_iY - getY() ) < 10. ) ) 47 67 return true; 48 68 else … … 53 73 bool VideoSpot::contains2( int p_iX, int p_iY ) 54 74 { 55 if( ( abs( p_iX - getX() ) < 25)75 if( ( fabs( p_iX - getX() ) < 25. ) 56 76 && 57 ( abs( p_iY - getY() ) < 25) )77 ( fabs( p_iY - getY() ) < 25. ) ) 58 78 return true; 59 79 else … … 64 84 void VideoSpot::append( int p_iX, int p_iY, int p_iWeight ) 65 85 { 66 // if( contains( p_iX , p_iY ) ) 67 // m_glPixels.append( new VideoPixel( p_iX, p_iY, p_iWeight ) ); 68 m_iXSum += p_iX * p_iWeight; 69 m_iYSum += p_iY * p_iWeight; 70 m_iWSum += p_iWeight; 71 m_iNumPixel++; 86 m_iXSum += p_iX * p_iWeight; 87 m_iYSum += p_iY * p_iWeight; 88 m_iWSum += p_iWeight; 89 m_iNumPixel++; 72 90 } 73 91 74 92 /** No descriptions */ 75 intVideoSpot::getX()93 double VideoSpot::getX() 76 94 { 77 return ( m_iXSum /m_iWSum );95 return ( (double) m_iXSum / (double) m_iWSum ); 78 96 } 79 97 80 98 /** No descriptions */ 81 intVideoSpot::getY()99 double VideoSpot::getY() 82 100 { 83 return ( m_iYSum /m_iWSum );101 return ( (double) m_iYSum / (double) m_iWSum ); 84 102 } 85 103 /** No descriptions */ -
trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/videospot.h
r4175 r4496 29 29 public: 30 30 VideoSpot(); 31 VideoSpot( int p_iX, int p_iY ); 31 VideoSpot( double p_iX, double p_iY, int p_iNumPixel ); 32 33 VideoSpot( const VideoSpot& p_Spot ); 34 VideoSpot& operator=( const VideoSpot& p_Spot ); 35 32 36 virtual ~VideoSpot(); 33 37 /** No descriptions */ … … 38 42 virtual void append( int p_iX, int p_iY, int p_iWeight ); 39 43 /** No descriptions */ 40 virtual intgetX();44 virtual double getX(); 41 45 /** No descriptions */ 42 virtual int getY(); 46 virtual double getY(); 47 /** No descriptions */ 48 virtual int getNumPixel() { return m_iNumPixel; } 43 49 /** No descriptions */ 44 50 virtual bool isValid(); 45 public: // Public attributes 46 /** */ 47 // QList<VideoPixel> m_qlPixels; 51 48 52 private: // Private attributes 49 53 /** */ … … 51 55 /** */ 52 56 int m_iYSum; 53 public: // Public attributes54 57 /** */ 55 58 int m_iNumPixel;
Note:
See TracChangeset
for help on using the changeset viewer.