2 #ifndef GRAMODS_CORE_ANGLE
3 #define GRAMODS_CORE_ANGLE
5 #include <gmCore/config.hh>
6 #include <gmCore/MathConstants.hh>
11 BEGIN_NAMESPACE_GMCORE;
30 void deg(
float v) { value = v * from_degrees; }
33 float deg() {
return value * to_degrees; }
36 void rad(
float v) { value = v; }
39 float rad() {
return value; }
42 void operator =(
float v) { value = v; }
45 operator float() {
return value; }
51 static constexpr
float from_degrees = (float)(GM_PI / 180.0);
54 static constexpr
float to_degrees = (float)(180.f / GM_PI);
69 BEGIN_NAMESPACE_GRAMODS;
79 std::istream& operator>> (std::istream &in,
gmCore::angle &v);
89 in >> s[0] >> s[1] >> s[2];
95 in >> s[0] >> s[1] >> s[2] >> s[3];
101 out << s[0] <<
" " << s[1];
107 out << s[0] <<
" " << s[1] <<
" " << s[2];
113 out << s[0] <<
" " << s[1] <<
" " << s[2] <<
" " << s[3];
117 END_NAMESPACE_GRAMODS;
std::array< angle, 2 > angle2
Array of 2 angle.
Definition: io_angle.hh:59
std::array< angle, 4 > angle4
Array of 4 angle.
Definition: io_angle.hh:65
std::array< angle, 3 > angle3
Array of 3 angle.
Definition: io_angle.hh:62
A simple placeholder for angle values expressed in radians.
Definition: io_angle.hh:20
float deg()
The angle, in degrees.
Definition: io_angle.hh:33
void deg(float v)
Set the angle, in degrees.
Definition: io_angle.hh:30
float value
The angle in radians.
Definition: io_angle.hh:48
float rad()
The angle, in radians.
Definition: io_angle.hh:39
void rad(float v)
Set the angle, in radians.
Definition: io_angle.hh:36