mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 18:44:00 +02:00
adds function to convert between angle units
This commit is contained in:
parent
06fc3ce00c
commit
0b183cf7a0
1 changed files with 10 additions and 0 deletions
|
@ -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.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue