]> Creatis software - creaRigidRegistration.git/blobdiff - lib/VectorMath.cxx
*** empty log message ***
[creaRigidRegistration.git] / lib / VectorMath.cxx
index 56f4b1b682d5f9b53f1df440617c66b50debda61..e9444c2fb5299df37984844d491c6b8f674d039c 100644 (file)
@@ -1,5 +1,7 @@
 #include "VectorMath.h"
 
+
+
 VectorMath::VectorMath()
 {
        
@@ -10,6 +12,7 @@ VectorMath::~VectorMath()
        
 }
 
+/*Sets all the vector points*/
 void VectorMath::SetData(std::vector<int> pointsX1, std::vector<int> pointsX2, std::vector<int> pointsY1, std::vector<int> pointsY2, std::vector<int> pointsZ1, std::vector<int> pointsZ2)
 {
     _pointx1a = pointsX1[0];
@@ -31,6 +34,7 @@ void VectorMath::SetData(std::vector<int> pointsX1, std::vector<int> pointsX2, s
        _pointz2b = pointsZ2[1];
 }
 
+/*Runs the calculations*/
 void VectorMath::Run()
 {
        _origin.clear();
@@ -38,11 +42,15 @@ void VectorMath::Run()
        _origin.push_back(_pointy2a);
        _origin.push_back(_pointz2a);
 
+       std::cout << "Vector Math: Origin points: X = " <<  _pointx2a << " Y = " << _pointy2a << " Z = " << _pointz2a << std::endl;
+
        _originReslicer.clear();
        _originReslicer.push_back(_pointx1a);
        _originReslicer.push_back(_pointy1a);
        _originReslicer.push_back(_pointz1a);
 
+       std::cout << "Vector Math: Origin Reslicer points: X = " <<  _pointx1a << " Y = " << _pointy1a << " Z = " << _pointz1a << std::endl;
+
        double _vectorA[3];
        _vectorA[0] =(double)(_pointx1b - _pointx1a);
        _vectorA[1] =(double)(_pointy1b - _pointy1a);
@@ -77,10 +85,15 @@ void VectorMath::Run()
        double distanceB = vtkMath::Distance2BetweenPoints(_vectorOrigin, _vectorA);
 
        double proportion = distanceA/distanceB;
-
+       /*
        _scaleX = proportion;
        _scaleY = proportion;
        _scaleZ = proportion;
+       */
+
+       _scaleX = 1;
+       _scaleY = 1;
+       _scaleZ = 1;
 
        _angle = acos(vtkMath::Dot(_vectorA, _vectorB));
 
@@ -90,37 +103,43 @@ void VectorMath::Run()
        std::cout << "Angle " << (double)_angle << std::endl;
 }
 
-
+/*Returns the origin of the second vector*/
 std::vector<int> VectorMath::GetOrigin()
 {
        return _origin;
 }
 
+/*Returns the origin of the first vector*/
 std::vector<int> VectorMath::GetOriginReslicer()
 {
        return _originReslicer;
 }
 
+/*Returns the cross product of the two vectors*/
 void VectorMath::GetResult(double result[3])
 {
        result = _result;
 }
 
+/*Scale in X*/
 double VectorMath::GetScaleX()
 {
        return _scaleX;
 }
 
+/*Scale in Y*/
 double VectorMath::GetScaleY()
 {
        return _scaleY;
 }
 
+/*Scale in Z*/
 double VectorMath::GetScaleZ()
 {
        return _scaleZ;
 }
 
+/*Rotation angle (dot product)*/
 double VectorMath::GetAngle()
 {
        return _angle;