Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 18, 2009, 6:23:31 PM (15 years ago)
Author:
rgrieder
Message:

Merged netp6 branch back to the trunk.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/util/Math.cc

    r3196 r3304  
    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
     
    175176                return orxonox::Vector2(0, 1);
    176177        }
    177         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 );
    178182
    179183        float distancelength = distance.length();
     
    182186
    183187        if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
    184             return orxonox::Vector2(sin(angle) * radius, cos(angle) * radius);
    185         else
    186             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);
    187191    }
    188192
Note: See TracChangeset for help on using the changeset viewer.