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 TranslatePanorama::TranslatePanorama(PanoramaData& panorama)
00029  : PanoramaAlgorithm(panorama)
00030 {
00031 }
00032 
00033 void TranslatePanorama::translatePano(PanoramaData& panorama, const double x, const double y, const double z)
00034 {
00035 
00036     for (unsigned int i = 0; i < panorama.getNrOfImages(); i++)
00037     {
00038         const SrcPanoImage & image = panorama.getImage(i);
00039         double ix = image.getX();
00040         double iy = image.getY();
00041         double iz = image.getZ();
00042         
00043         // Don't update a variable linked to a variable we already updated.
00044         SrcPanoImage copy = image;
00045         #define conditional_set(variable, value) \
00046         if (image.variable##isLinked())\
00047         {\
00048             unsigned int j = 0;\
00049             while (j < i && !image.variable##isLinkedWith(panorama.getImage(j)))\
00050             {\
00051                 j++;\
00052             }\
00053             if (j == i) copy.set##variable(value);\
00054         } else {\
00055             copy.set##variable(value);\
00056         }
00057         conditional_set(X, ix+x);
00058         conditional_set(Y, iy+y);
00059         conditional_set(Z, iz+z);
00060         
00061         panorama.setImage(i, copy);
00062         panorama.imageChanged(i);
00063     }
00064 }
00065 
00066 
00067 } //namespace

Generated on Tue Sep 30 01:25:37 2014 for Hugintrunk by  doxygen 1.3.9.1