From 443eb126e59e3ef12ace69cc84379eab95686eeb Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Tue, 23 Mar 2010 09:43:26 +0000
Subject: [PATCH] bugfix: sign of the derivative of the squared distance was
 wrong

[[Imported from SVN: r5792]]
---
 src/rotation.hh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/rotation.hh b/src/rotation.hh
index 07cb02ee..9cccac85 100644
--- a/src/rotation.hh
+++ b/src/rotation.hh
@@ -80,7 +80,10 @@ public:
 
     static TangentVector derivativeOfDistanceSquaredWRTSecondArgument(const Rotation<2,T>& a, 
                                                                       const Rotation<2,T>& b) {
-        return -2 * distance(a,b);
+        // This assertion is here to remind me of the following laziness:
+        // The difference has to be computed modulo 2\pi
+        assert( std::fabs(a.angle_ - b.angle_) <= M_PI );
+        return -2 * (a.angle_ - b.angle_);
     }
 
     static Dune::FieldMatrix<double,1,1> secondDerivativeOfDistanceSquaredWRTSecondArgument(const Rotation<2,T>& a, 
-- 
GitLab