adds function to convert between angle units

This commit is contained in:
tosh 2013-03-29 00:30:57 +01:00
parent 06fc3ce00c
commit 0b183cf7a0

View file

@ -32,6 +32,16 @@ struct Rotations
static float half_pi() { return 0.25f; }
};
/**
* Converts an angle from one unit to another.
*/
template< class UnitFrom, class UnitTo >
float angleConvert(float a)
{
return a * (UnitTo::half_pi() / UnitFrom::half_pi());
}
/**
* Clamps an angle to the range of [-180; 180) degrees.
*/