[Orxonox-commit 728] r3258 - branches/netp6/src/util

scheusso at orxonox.net scheusso at orxonox.net
Tue Jun 30 16:24:36 CEST 2009


Author: scheusso
Date: 2009-06-30 16:24:36 +0200 (Tue, 30 Jun 2009)
New Revision: 3258

Modified:
   branches/netp6/src/util/Math.cc
Log:
see ticket #329


Modified: branches/netp6/src/util/Math.cc
===================================================================
--- branches/netp6/src/util/Math.cc	2009-06-30 13:14:45 UTC (rev 3257)
+++ branches/netp6/src/util/Math.cc	2009-06-30 14:24:36 UTC (rev 3258)
@@ -135,13 +135,14 @@
             else
                 return orxonox::Vector2(0, 1);
         }
-
-        float angle = acos(clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1));
-
+      
+        float cos_value = clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1);
+        float sin_value = sqrt( 1 - cos_value*cos_value );
+      
         if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
-            return orxonox::Vector2(sin(angle), cos(angle));
+            return orxonox::Vector2( sin_value, cos_value );
         else
-            return orxonox::Vector2(-sin(angle), cos(angle));
+            return orxonox::Vector2( -sin_value, cos_value );
     }
 
     /**




More information about the Orxonox-commit mailing list