Rev 2097 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1735 | jag | 1 | /* |
2 | * angle.h |
||
2302 | jag | 3 | * DIN Is Noise is copyright (c) 2006-2025 Jagannathan Sampath |
1735 | jag | 4 | * DIN Is Noise is released under GNU Public License 2.0 |
5 | * For more information, please visit https://dinisnoise.org/ |
||
6 | */ |
||
7 | |||
1833 | jag | 8 | #ifndef __anglet__ |
9 | #define __anglet__ |
||
1737 | jag | 10 | |
11 | #include <fstream> |
||
12 | |||
13 | struct anglet { |
||
14 | |||
1735 | jag | 15 | float deg; |
16 | float rad; |
||
1737 | jag | 17 | |
1764 | jag | 18 | anglet (float d) { |
19 | operator= (d); |
||
20 | } |
||
21 | |||
1737 | jag | 22 | anglet () { |
23 | deg = rad = 0.0f; |
||
24 | } |
||
25 | |||
26 | anglet& operator= (const float& v) { |
||
27 | deg = v; |
||
28 | torad (); |
||
29 | return *this; |
||
30 | } |
||
31 | |||
1746 | jag | 32 | anglet& operator+= (const float& v) { |
33 | deg += v; |
||
34 | torad (); |
||
35 | return *this; |
||
36 | } |
||
37 | |||
1737 | jag | 38 | void torad () { |
39 | extern const float PI_BY_180; |
||
40 | rad = deg * PI_BY_180; |
||
41 | } |
||
42 | |||
1735 | jag | 43 | }; |
1737 | jag | 44 | |
45 | std::ostream& operator<< (std::ostream& f, anglet& a); |
||
46 | std::istream& operator>> (std::istream& f, anglet& a); |
||
47 | |||
1735 | jag | 48 | #endif |