Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 30, 2009, 4:24:36 PM (15 years ago)
Author:
scheusso
Message:

see ticket #329

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/netp6/src/util/Math.cc

    r3196 r3258  
    136136                return orxonox::Vector2(0, 1);
    137137        }
    138 
    139         float angle = acos(clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1));
    140 
     138     
     139        float cos_value = clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1);
     140        float sin_value = sqrt( 1 - cos_value*cos_value );
     141     
    141142        if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
    142             return orxonox::Vector2(sin(angle), cos(angle));
    143         else
    144             return orxonox::Vector2(-sin(angle), cos(angle));
     143            return orxonox::Vector2( sin_value, cos_value );
     144        else
     145            return orxonox::Vector2( -sin_value, cos_value );
    145146    }
    146147
Note: See TracChangeset for help on using the changeset viewer.