TranslatePanorama.cpp

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00022 #include "TranslatePanorama.h"
00023 
00024 
00025 namespace HuginBase {
00026 
00028 void TranslatePanorama::translatePano(PanoramaData& panorama, const double x, const double y, const double z)
00029 {
00030 
00031     for (unsigned int i = 0; i < panorama.getNrOfImages(); i++)
00032     {
00033         const SrcPanoImage & image = panorama.getImage(i);
00034         double ix = image.getX();
00035         double iy = image.getY();
00036         double iz = image.getZ();
00037         
00038         // Don't update a variable linked to a variable we already updated.
00039         SrcPanoImage copy = image;
00040         #define conditional_set(variable, value) \
00041         if (image.variable##isLinked())\
00042         {\
00043             unsigned int j = 0;\
00044             while (j < i && !image.variable##isLinkedWith(panorama.getImage(j)))\
00045             {\
00046                 j++;\
00047             }\
00048             if (j == i) copy.set##variable(value);\
00049         } else {\
00050             copy.set##variable(value);\
00051         }
00052         conditional_set(X, ix+x);
00053         conditional_set(Y, iy+y);
00054         conditional_set(Z, iz+z);
00055         
00056         panorama.setImage(i, copy);
00057         panorama.imageChanged(i);
00058     }
00059 }
00060 
00061 
00062 } //namespace

Generated on 2 Aug 2015 for Hugintrunk by  doxygen 1.4.7