[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Toon-members] TooN so3.h [Maintenance_Branch_1_x]
From: |
Gerhard Reitmayr |
Subject: |
[Toon-members] TooN so3.h [Maintenance_Branch_1_x] |
Date: |
Thu, 12 Mar 2009 18:16:59 +0000 |
CVSROOT: /cvsroot/toon
Module name: TooN
Branch: Maintenance_Branch_1_x
Changes by: Gerhard Reitmayr <gerhard> 09/03/12 18:16:59
Modified files:
. : so3.h
Log message:
forgot to check for the correct direction
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/so3.h?cvsroot=toon&only_with_tag=Maintenance_Branch_1_x&r1=1.23.2.2&r2=1.23.2.3
Patches:
Index: so3.h
===================================================================
RCS file: /cvsroot/toon/TooN/so3.h,v
retrieving revision 1.23.2.2
retrieving revision 1.23.2.3
diff -u -b -r1.23.2.2 -r1.23.2.3
--- so3.h 12 Mar 2009 16:49:45 -0000 1.23.2.2
+++ so3.h 12 Mar 2009 18:16:59 -0000 1.23.2.3
@@ -236,21 +236,25 @@
my_matrix[1][1] - cos_angle,
my_matrix[2][2] - cos_angle
);
+ TooN::Vector<3> r2;
if(fabs(diag[0]) > fabs(diag[1]) && fabs(diag[0]) > fabs(diag[2])){ //
first is largest, fill with first column
- result[0] = diag[0];
- result[1] = (my_matrix[1][0]+my_matrix[0][1])/2;
- result[2] = (my_matrix[0][2]+my_matrix[2][0])/2;
+ r2[0] = diag[0];
+ r2[1] = (my_matrix[1][0]+my_matrix[0][1])/2;
+ r2[2] = (my_matrix[0][2]+my_matrix[2][0])/2;
} else if(fabs(diag[1]) > fabs(diag[2])) { //
second is largest, fill with second column
- result[0] = (my_matrix[1][0]+my_matrix[0][1])/2;
- result[1] = diag[1];
- result[2] = (my_matrix[2][1]+my_matrix[1][2])/2;
+ r2[0] = (my_matrix[1][0]+my_matrix[0][1])/2;
+ r2[1] = diag[1];
+ r2[2] = (my_matrix[2][1]+my_matrix[1][2])/2;
} else { //
third is largest, fill with third column
- result[0] = (my_matrix[0][2]+my_matrix[2][0])/2;
- result[1] = (my_matrix[2][1]+my_matrix[1][2])/2;
- result[2] = diag[2];
+ r2[0] = (my_matrix[0][2]+my_matrix[2][0])/2;
+ r2[1] = (my_matrix[2][1]+my_matrix[1][2])/2;
+ r2[2] = diag[2];
}
- normalize(result);
- result *= angle;
+ // flip, if we point in the wrong direction!
+ if(r2 * result < 0)
+ r2 *= -1;
+ normalize(r2);
+ result = angle * r2;
} else { // can use small angle approximation, because we are around zero
// nothing to do here
}