Lines 41
##### Keywords
angle (3) degree (3) radian (3)
##### Permissions
Viewable by Everyone
Editable by All Siafoo Users
Don't get spied on – We respect your privacy and provide numerous options to protect it.

# angle.cpp -1

 In Brief Functions that implement the Angle class in angle.h
 Language C++
# 's
` 1#include "angle.h" 2 3/// Untwists an angle (in radians) to range [0, 2*Pi) 4double Angle::Clamp0To2Pi() const 5{ 6   double angle = m_radians; 7   while(angle >= TWOPI) 8      angle -= TWOPI; 910   while(angle < 0)11      angle += TWOPI;1213   return angle;14}1516/// Untwists an angle (in radians) to range [-Pi, Pi]17double Angle::ClampNegPiToPi() const18{19   double angle = m_radians;20   while(angle > PI)21       angle -= TWOPI;2223   while(angle < -PI)24       angle += TWOPI;2526   return angle;27}2829/// Untwists an angle (in degrees) to range [0, 360]30double Angle::Clamp0To360() const31{32    double angle = radians2Degrees(m_radians);33    while(angle >= 360)34        angle -= 360;35        36    while(angle < 0)37        angle += 360;38        39    return angle;40}4142double Angle::degrees2Radians(double angle_degrees)43{44   return angle_degrees * PI / 180;45}4647double Angle::radians2Degrees( double angle_radians )48{49   return angle_radians * 180 / PI;50}`

Functions that implement the Angle class in angle.h