]> Creatis software - creaRigidRegistration.git/blobdiff - PackRecalage/src/bbPackRecalageTransform3D3PointsBox.cxx
#2810 crea RigidRegistration Bug New Normal - update Transform3D3PointsBox
[creaRigidRegistration.git] / PackRecalage / src / bbPackRecalageTransform3D3PointsBox.cxx
index d5c2467a95e56f4668c0e843d0f11a428f709c9a..219da2bc1218f1697bca4b91492cba2c95b1272b 100644 (file)
@@ -186,18 +186,18 @@ void Transform3D3PointsBox::Process()
                //Calculates the new position of the points after the first transformation
                double A2N[3]; 
                A2N[0] = A2[0]*newMatrix[0][0] + A2[0]*newMatrix[0][1] + A2[0]*newMatrix[0][2];
-               A2N[1] = A2[1]*newMatrix[1][0] + A2[0]*newMatrix[1][1] + A2[0]*newMatrix[1][2];
-               A2N[2] = A2[2]*newMatrix[2][0] + A2[0]*newMatrix[2][1] + A2[0]*newMatrix[2][2];
+               A2N[1] = A2[1]*newMatrix[1][0] + A2[1]*newMatrix[1][1] + A2[1]*newMatrix[1][2];
+               A2N[2] = A2[2]*newMatrix[2][0] + A2[2]*newMatrix[2][1] + A2[2]*newMatrix[2][2];
 
                double B2N[3]; 
                B2N[0] = B2[0]*newMatrix[0][0] + B2[0]*newMatrix[0][1] + B2[0]*newMatrix[0][2];
-               B2N[1] = B2[1]*newMatrix[1][0] + B2[0]*newMatrix[1][1] + B2[0]*newMatrix[1][2];
-               B2N[2] = B2[2]*newMatrix[2][0] + B2[0]*newMatrix[2][1] + B2[0]*newMatrix[2][2];
+               B2N[1] = B2[1]*newMatrix[1][0] + B2[1]*newMatrix[1][1] + B2[1]*newMatrix[1][2];
+               B2N[2] = B2[2]*newMatrix[2][0] + B2[2]*newMatrix[2][1] + B2[2]*newMatrix[2][2];
 
                double O2N[3]; 
                O2N[0] = O2[0]*newMatrix[0][0] + O2[0]*newMatrix[0][1] + O2[0]*newMatrix[0][2];
-               O2N[1] = O2[1]*newMatrix[1][0] + O2[0]*newMatrix[1][1] + O2[0]*newMatrix[1][2];
-               O2N[2] = O2[2]*newMatrix[2][0] + O2[0]*newMatrix[2][1] + O2[0]*newMatrix[2][2];
+               O2N[1] = O2[1]*newMatrix[1][0] + O2[1]*newMatrix[1][1] + O2[1]*newMatrix[1][2];
+               O2N[2] = O2[2]*newMatrix[2][0] + O2[2]*newMatrix[2][1] + O2[2]*newMatrix[2][2];
 
                ///////////////////////////////////////////////////////////////////////////////
                //Creation of the two planes for the second transformation
@@ -235,6 +235,22 @@ void Transform3D3PointsBox::Process()
 
                transformer->SetSecondAngle(-anglePlanes);
 
+
+               double * vector2B;
+               vector2B = planes->makeVector(O2, B2);
+               double mag1= planes->getMagnitud(vector1B);
+               double mag2= planes->getMagnitud(vector2B);
+               transformer->SetScale(mag1/mag2);
+
+
+/*
+               double * vector2B;
+               vector2B = planes->makeVector(O2, B2);
+               double mag1= planes->getMagnitud(vector1);
+               double mag2= planes->getMagnitud(vector2);
+               transformer->SetScale(mag2/mag1);
+*/
+
                // The calculation of the transformations are made
                transformer->Run();