Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

Rotate.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Rotate_h
00002 #define Impala_Core_Array_Rotate_h
00003 
00004 #include "Core/Geometry/GeoIntType.h"
00005 #include "Core/Matrix/MatMakeTranslate2d.h"
00006 #include "Core/Matrix/MatMakeRotate2dDeg.h"
00007 #include "Core/Matrix/MatMul.h"
00008 #include "Core/Array/Pattern/PatGeometricOp.h"
00009 
00010 namespace Impala
00011 {
00012 namespace Core
00013 {
00014 namespace Array
00015 {
00016 
00017 
00018 template<class DstArrayT, class SrcArrayT>
00019 inline void
00020 Rotate(DstArrayT*& dst, SrcArrayT* src, double alpha, Geometry::GeoIntType gi,
00021        bool adjustSize, typename DstArrayT::ArithType background)
00022 {
00023     int cx = src->CW() / 2;
00024     int cy = src->CH() / 2;
00025     Matrix::Mat* mTrans1 = Matrix::MatMakeTranslate2d(cx, cy);
00026     Matrix::Mat* mRot = Matrix::MatMakeRotate2dDeg(-alpha); // Y-axis points down
00027     Matrix::Mat* mTrans2 = Matrix::MatMakeTranslate2d(-cx, -cy);
00028 
00029     Matrix::Mat* mRes1 = Matrix::MatMul(mTrans1, mRot);
00030     Matrix::Mat* mRes2 = Matrix::MatMul(mRes1, mTrans2);
00031     Pattern::PatGeometricOp(dst, src, mRes2, true, gi, adjustSize, background);
00032 
00033     delete mTrans1;
00034     delete mRot;
00035     delete mTrans2;
00036     delete mRes1;
00037     delete mRes2;
00038 }
00039 
00040 } // namespace Array
00041 } // namespace Core
00042 } // namespace Impala
00043 
00044 #endif

Generated on Fri Mar 19 09:30:53 2010 for ImpalaSrc by  doxygen 1.5.1