Hi folks,

when I’d like to know the angle between two vectors, sometimes I get negative values (radian or degree). How do you convert them so I always get positive values?

Flash seems to have a strange system for calculating angles. I used the following code for doing this, but sometimes I get negative values. Please - can someone help me with this problem?

```
public function rangedAngleBetween(otherVector:EuclideanVector):Number
{
var firstAngle:Number;
var secondAngle:Number;
var angle:Number;
firstAngle = Math.atan2(otherVector.position.y, otherVector.position.x);
secondAngle = Math.atan2(position.y, position.x);
angle = secondAngle - firstAngle;
while (angle > Math.PI)
angle -= Math.PI * 2;
while (angle < -Math.PI)
angle += Math.PI * 2;
return angle;
}
```