Commit 469c4978 authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

dsound: Correctly calculate angle between vectors with equal and opposite directions.

parent e32fe9ba
......@@ -111,7 +111,13 @@ static inline D3DVALUE AngleBetweenVectorsRad (const D3DVECTOR *a, const D3DVECT
return 0;
cos = product/(la*lb);
angle = acos(cos);
if(cos > 1.f){
angle = 0;
}else if(cos < -1.f){
angle = M_PI;
}else{
angle = acos(cos);
}
TRACE("angle between (%f,%f,%f) and (%f,%f,%f) = %f radians (%f degrees)\n", a->x, a->y, a->z, b->x,
b->y, b->z, angle, RadToDeg(angle));
return angle;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment