Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3259


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

bonus to ticket 329 ;)

File:
1 edited

Legend:

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

    r3258 r3259  
    136136                return orxonox::Vector2(0, 1);
    137137        }
    138      
     138       
    139139        float cos_value = clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1);
    140140        float sin_value = sqrt( 1 - cos_value*cos_value );
    141      
     141       
    142142        if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
    143143            return orxonox::Vector2( sin_value, cos_value );
     
    176176                return orxonox::Vector2(0, 1);
    177177        }
    178         float angle = acos(clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1));
     178        //float angle = acos(clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1));
     179       
     180        float cos_value = clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1);
     181        float sin_value = sqrt( 1 - cos_value*cos_value );
    179182
    180183        float distancelength = distance.length();
     
    183186
    184187        if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
    185             return orxonox::Vector2(sin(angle) * radius, cos(angle) * radius);
    186         else
    187             return orxonox::Vector2(-sin(angle) * radius, cos(angle) * radius);
     188            return orxonox::Vector2( sin_value * radius, cos_value * radius);
     189        else
     190            return orxonox::Vector2( -sin_value * radius, cos_value * radius);
    188191    }
    189192
Note: See TracChangeset for help on using the changeset viewer.