toon-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Toon-members] tag/src absorient.cpp


From: Gerhard Reitmayr
Subject: [Toon-members] tag/src absorient.cpp
Date: Wed, 06 May 2009 12:52:20 +0000

CVSROOT:        /cvsroot/toon
Module name:    tag
Changes by:     Gerhard Reitmayr <gerhard>      09/05/06 12:52:20

Modified files:
        src            : absorient.cpp 

Log message:
        make robust

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/tag/src/absorient.cpp?cvsroot=toon&r1=1.7&r2=1.8

Patches:
Index: absorient.cpp
===================================================================
RCS file: /cvsroot/toon/tag/src/absorient.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- absorient.cpp       28 Apr 2009 10:36:41 -0000      1.7
+++ absorient.cpp       6 May 2009 12:52:20 -0000       1.8
@@ -59,9 +59,12 @@
 
 // computes the orientation from (e1,e2,e3) -> (a,(a^b)^a,a^b), which means 
that b the second vector is in the a, b plane
 static inline TooN::SO3<>  canonicalOrientation( const TooN::Vector<3> & a, 
const TooN::Vector<3> & b ){
+    TooN::Vector<3> n = a ^ b;
+    if(norm_sq(n) == 0)
+       return TooN::SO3<>();
     TooN::Matrix<3> result;
     result.T()[0] = unit(a);
-    result.T()[2] = unit(a ^ b);
+    result.T()[2] = unit(n);
     result.T()[1] = result.T()[2] ^ result.T()[0];
     return TooN::SO3<> (result);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]