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

Mirror.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Mirror_h
00002 #define Impala_Core_Array_Mirror_h
00003 
00004 namespace Impala
00005 {
00006 namespace Core
00007 {
00008 namespace Array
00009 {
00010 
00011 // mirror along the Y axis (e.g. the X coordinates are negated)
00012 // function also works inplace
00013 template<class DstArrayT, class Src1ArrayT>
00014 inline void
00015 MirrorY(DstArrayT*& dst, Src1ArrayT* src1)
00016 {
00017     if (dst == 0)
00018         dst = ArrayClone<DstArrayT>(src1);
00019     // this function also mirrors the borders
00020     for(int y = 0; y < src1->H(); y++)
00021     {
00022         for(int x = 0; x < src1->W() / 2; x++)
00023         {
00024             int x2 = src1->W() - x - 1;
00025             typename Src1ArrayT::ArithType tmp = src1->Value(x, y);
00026             typename Src1ArrayT::ArithType tmp2 = src1->Value(x2, y);
00027             dst->SetValue(tmp, x2, y);
00028             dst->SetValue(tmp2, x, y);
00029         }
00030     }
00031 }
00032 
00033 } // namespace Array
00034 } // namespace Core
00035 } // namespace Impala
00036 
00037 #endif

Generated on Thu Jan 13 09:04:08 2011 for ImpalaSrc by  doxygen 1.5.1