keypointpair.cc
Go to the documentation of this file.00001 #include "keypointpair.h"
00002 #include "keypoint.h"
00003 #include <cmath>
00004
00005 keypointPair::keypointPair(keypoint* k1, keypoint* k2)
00006 : key1(k1), key2(k2),
00007 xDiff(key2->modelX - key1->imageX),
00008 yDiff(key2->modelY - key1->imageY),
00009 scaleZoom(key2->modelScale / key1->imageScale),
00010 orientationDiff(key2->modelOrientation - key1->imageOrientation)
00011 {
00012 while (orientationDiff > M_PI) orientationDiff -= (2 * M_PI);
00013 while (orientationDiff <= -M_PI) orientationDiff += (2 * M_PI);
00014 }
00015
00016 keypointPair::keypointPair(keypointPair* k)
00017 : key1(k->key1), key2(k->key2),
00018 xDiff(k->xDiff), yDiff(k->yDiff),
00019 scaleZoom(k->scaleZoom), orientationDiff(k->orientationDiff) {}
00020
00021 void keypointPair::getForwardTransform(double* xTranslate, double* yTranslate, double* zoom, double* rotation){
00022 *xTranslate = xDiff;
00023 *yTranslate = yDiff;
00024 *zoom = scaleZoom;
00025 *rotation = orientationDiff;
00026 }
00027
00028 void keypointPair::getBackwardTransform(double* xTranslate, double* yTranslate, double* zoom, double* rotation){
00029 *xTranslate = -xDiff;
00030 *yTranslate = -yDiff;
00031 *zoom = 1.0/scaleZoom;
00032 *rotation = -orientationDiff;
00033 }
00034