scifir-units 2.0.0
scifir-units is a library of units of measurement, angles, coordinates, fields, and related data, all lightweight, that help in the development of scientific software and scientific machines
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
scifir::angle Class Reference

Class that allows to work with angles. Each angle sizes 4 bytes. Initialization string example: "20°". More...

#include <angle.hpp>

Inheritance diagram for scifir::angle:
Inheritance graph
[legend]

Public Types

enum  type : int8_t { DEGREE , RADIAN , GRADIAN , TURN }
 Represents an type of angle, which can be a degree or a radian. The value of the angle inside the angle class is always stored in degrees, but can be get in radian if it's needed. More...
 

Public Member Functions

 angle ()
 Default constructor of angle. The value is set to 0.
 
 angle (const angle &x)
 Copy constructor of angle. The value is copied from the angle x.
 
 angle (angle &&x)
 Move constructor of angle. The value is moved from the angle x.
 
 angle (float new_value, angle::type init_type=angle::DEGREE)
 Constructor of angle. The value is initialized to the float new_value. init_type is not stored as a member-variable, but instead allows to select if the value is given in DEGREE or in RADIAN. By default it's in DEGREE.
 
 angle (double new_value, angle::type init_type=angle::DEGREE)
 Constructor of angle. The value is initialized from the double new_value casted to a float. init_type is not stored as a member-variable, but instead allows to select if the value is given in DEGREE or in RADIAN. By default it's in DEGREE.
 
 angle (long double new_value, angle::type init_type=angle::DEGREE)
 Constructor of angle. The value is initialized from the long double new_value casted to a float. init_type is not stored as a member-variable, but instead allows to select if the value is given in DEGREE or in RADIAN. By default it's in DEGREE.
 
 angle (int new_value, angle::type init_type=angle::DEGREE)
 Constructor of angle. The value is initialized from the int new_value casted to a float. init_type is not stored as a member-variable, but instead allows to select if the value is given in DEGREE or in RADIAN. By default it's in DEGREE.
 
 angle (const string &init_angle)
 Constructor of angle. The value is initialized from the initialization string of angle, which uses the character 00B0 or the character 00BA to represent degrees.
 
 angle (const scalar_unit &x)
 Constructor of angle. The value is initialized from the scalar_unit x, if the scalar_unit has empty dimensions.
 
angleoperator= (const angle &x)
 Copy assignment of angle. The value is copied to the value of angle x.
 
angleoperator= (angle &&x)
 Move assignment of angle. The value is moved from the value of angle x.
 
angleoperator= (float new_value)
 Assignment operator. The value is copied from the float.
 
angleoperator= (const string &init_angle)
 Assignment operator. An initialization string is used to set the value, which contains the character 00B0 or the character 00BA to represent degrees.
 
angleoperator= (const scalar_unit &x)
 Assignment operator. The value of the angle is set to the value of the scalar_unit x, only if the scalar_unit has empty dimensions.
 
 operator float () const
 Cast angle to a float.
 
const floatget_value () const
 Gets the value of the angle, in degrees.
 
angle operator+ (const angle &x) const
 Creates a new angle as the sum of other two.
 
angle operator- (const angle &x) const
 Creates a new angle as the substraction of this angle and another angle x.
 
angle operator* (const angle &x) const
 Creates a new angle as the multiplication of other two.
 
angle operator/ (const angle &x) const
 Creates a new angle as the division of this angle and another angle x.
 
angle operator^ (const angle &x) const
 Creates a new angle by powering the angle class with the value of another angle x.
 
void operator+= (const angle &x)
 Sums the value of the angle x to the value of this angle. The value is normalized after.
 
void operator-= (const angle &x)
 Substract the value of the angle x to the value of this angle. The value is normalized after.
 
void operator*= (const angle &x)
 Multiplies the value of this angle with the value of angle x. The value is normalized after.
 
void operator/= (const angle &x)
 Divides the value of this angle with the value of angle x. The value is normalized after.
 
void operator^= (const angle &x)
 Powers the value of this angle with the value of angle x. The value is normalized after.
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
void operator= (T new_value)
 Sets the value to the value of some numeric type, casting it to a float first, and normalizing the value after that.
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
angle operator+ (T x) const
 Creates a new angle as the sum of a numeric type with the value of this angle.
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
angle operator- (T x) const
 Creates a new angle as the substraction of the value of this angle with a numeric type.
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
angle operator* (T x) const
 Creates a new angle as the multiplication of a numeric type with the value of this angle.
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
angle operator/ (T x) const
 Creates a new angle as the division of a numeric type with the value of this angle.
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
angle operator^ (T x) const
 Creates a new angle as the power of the value of this angle with a numeric type.
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
void operator+= (T x)
 Sums a numeric type to the value of this angle.
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
void operator-= (T x)
 Substracts a numeric type to the value of this angle.
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
void operator*= (T x)
 Multiplies a numeric type to the value of this angle.
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
void operator/= (T x)
 Divides a numeric type to the value of this angle.
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
void operator^= (T x)
 Powers a numeric type to the value of this angle.
 
angleoperator++ ()
 Increments the value by one.
 
angle operator++ (int)
 Increments the value by one.
 
angleoperator-- ()
 Decrements the value by one.
 
angle operator-- (int)
 Decrements the value by one.
 
void invert ()
 Inverts the angle to the opposite direction in a 2D plane, which is to add 180 degrees. The value is normalized after.
 
scalar_unit to_scalar_unit () const
 Creates a scalar_unit with the same value and degree dimensions.
 
string display (int number_of_decimals=2) const
 Creates an string from the angle, with the value and the degrees symbol.
 
float get_degree () const
 Gets the value of the angle in degrees.
 
float get_radian () const
 Gets the value of the angle in radians.
 

Protected Member Functions

void initialize_from_string (string init_angle)
 Internal function. Sets the value of the angle to a new value using the initialization string of angles.
 

Protected Attributes

float value
 Value of the angle. It is stored in degrees.
 

Private Member Functions

void normalize_value ()
 Internal function. Normalizes the value, which means to maintain the same angle within 0 and 360. If the value is lower or greather it gets converted to their equivalent counterpart within this range.
 

Detailed Description

Class that allows to work with angles. Each angle sizes 4 bytes. Initialization string example: "20°".

angle is a class that allows to work with angles, more in degrees than in radians. The value of the angle is always stored inside the class in degrees, and it can be get in radians with the to_radian() function.

Definition at line 76 of file angle.hpp.

Member Enumeration Documentation

◆ type

Represents an type of angle, which can be a degree or a radian. The value of the angle inside the angle class is always stored in degrees, but can be get in radian if it's needed.

Enumerator
DEGREE 

The angle is in DEGREE. A degree is defined as a 1/360 part of a circle. The entire circle corresponds to 360 degrees.

RADIAN 

The angle is in RADIAN. A radian is defined as the length of the perimeter of the circle that conforms an angle.

GRADIAN 
TURN 

Definition at line 79 of file angle.hpp.

79: int8_t {DEGREE,RADIAN,GRADIAN,TURN};
@ DEGREE
The angle is in DEGREE. A degree is defined as a 1/360 part of a circle. The entire circle correspond...
Definition angle.hpp:79
@ RADIAN
The angle is in RADIAN. A radian is defined as the length of the perimeter of the circle that conform...
Definition angle.hpp:79

Constructor & Destructor Documentation

◆ angle() [1/9]

angle::angle ( )

Default constructor of angle. The value is set to 0.

Definition at line 18 of file angle.cpp.

18 : value(0.0f)
19 {}
float value
Value of the angle. It is stored in degrees.
Definition angle.hpp:212

◆ angle() [2/9]

angle::angle ( const angle x)

Copy constructor of angle. The value is copied from the angle x.

Definition at line 21 of file angle.cpp.

21 : value(x.get_value())
22 {}

◆ angle() [3/9]

angle::angle ( angle &&  x)

Move constructor of angle. The value is moved from the angle x.

Definition at line 24 of file angle.cpp.

24 : value(std::move(x.get_value()))
25 {}

◆ angle() [4/9]

angle::angle ( float  new_value,
angle::type  init_type = angle::DEGREE 
)
explicit

Constructor of angle. The value is initialized to the float new_value. init_type is not stored as a member-variable, but instead allows to select if the value is given in DEGREE or in RADIAN. By default it's in DEGREE.

Definition at line 27 of file angle.cpp.

27 : value()
28 {
29 if (init_type == angle::DEGREE)
30 {
31 value = new_value;
32 }
33 else if (init_type == angle::RADIAN)
34 {
35 value = radian_to_degree(new_value);
36 }
37 else if (init_type == angle::GRADIAN)
38 {
39 value = gradian_to_degree(new_value);
40 }
41 else if (init_type == angle::TURN)
42 {
43 value = turn_to_degree(new_value);
44 }
46 }
void normalize_value()
Internal function. Normalizes the value, which means to maintain the same angle within 0 and 360....
Definition angle.cpp:276
float radian_to_degree(float x)
Converts a radian to degree.
Definition angle.hpp:16
float turn_to_degree(float x)
Definition angle.hpp:26
float gradian_to_degree(float x)
Definition angle.hpp:21

◆ angle() [5/9]

angle::angle ( double  new_value,
angle::type  init_type = angle::DEGREE 
)
explicit

Constructor of angle. The value is initialized from the double new_value casted to a float. init_type is not stored as a member-variable, but instead allows to select if the value is given in DEGREE or in RADIAN. By default it's in DEGREE.

Definition at line 48 of file angle.cpp.

48 : value()
49 {
50 if (init_type == angle::DEGREE)
51 {
52 value = float(new_value);
53 }
54 else if (init_type == angle::RADIAN)
55 {
56 value = radian_to_degree(float(new_value));
57 }
58 else if (init_type == angle::GRADIAN)
59 {
60 value = gradian_to_degree(float(new_value));
61 }
62 else if (init_type == angle::TURN)
63 {
64 value = turn_to_degree(float(new_value));
65 }
67 }

◆ angle() [6/9]

angle::angle ( long double  new_value,
angle::type  init_type = angle::DEGREE 
)
explicit

Constructor of angle. The value is initialized from the long double new_value casted to a float. init_type is not stored as a member-variable, but instead allows to select if the value is given in DEGREE or in RADIAN. By default it's in DEGREE.

Definition at line 69 of file angle.cpp.

69 : value()
70 {
71 if (init_type == angle::DEGREE)
72 {
73 value = float(new_value);
74 }
75 else if (init_type == angle::RADIAN)
76 {
77 value = radian_to_degree(float(new_value));
78 }
79 else if (init_type == angle::GRADIAN)
80 {
81 value = gradian_to_degree(float(new_value));
82 }
83 else if (init_type == angle::TURN)
84 {
85 value = turn_to_degree(float(new_value));
86 }
88 }

◆ angle() [7/9]

angle::angle ( int  new_value,
angle::type  init_type = angle::DEGREE 
)
explicit

Constructor of angle. The value is initialized from the int new_value casted to a float. init_type is not stored as a member-variable, but instead allows to select if the value is given in DEGREE or in RADIAN. By default it's in DEGREE.

Definition at line 90 of file angle.cpp.

90 : value()
91 {
92 if (init_type == angle::DEGREE)
93 {
94 value = float(new_value);
95 }
96 else if (init_type == angle::RADIAN)
97 {
98 value = radian_to_degree(float(new_value));
99 }
100 else if (init_type == angle::GRADIAN)
101 {
102 value = gradian_to_degree(float(new_value));
103 }
104 else if (init_type == angle::TURN)
105 {
106 value = turn_to_degree(float(new_value));
107 }
109 }

◆ angle() [8/9]

angle::angle ( const string init_angle)
explicit

Constructor of angle. The value is initialized from the initialization string of angle, which uses the character 00B0 or the character 00BA to represent degrees.

Definition at line 111 of file angle.cpp.

111 : value()
112 {
113 initialize_from_string(init_angle);
114 }
void initialize_from_string(string init_angle)
Internal function. Sets the value of the angle to a new value using the initialization string of angl...
Definition angle.cpp:297

◆ angle() [9/9]

angle::angle ( const scalar_unit x)
explicit

Constructor of angle. The value is initialized from the scalar_unit x, if the scalar_unit has empty dimensions.

Definition at line 116 of file angle.cpp.

117 {
118 if (x.has_empty_dimensions())
119 {
120 value = float(x);
122 }
123 else
124 {
125 cerr << "An angle cannot be initialized with dimensions" << endl;
126 value = 0.0f;
127 }
128 }

Member Function Documentation

◆ display()

string angle::display ( int  number_of_decimals = 2) const

Creates an string from the angle, with the value and the degrees symbol.

Definition at line 261 of file angle.cpp.

262 {
263 ostringstream output;
264 if (get_value() == -0)
265 {
266 output << 0;
267 }
268 else
269 {
270 output << display_float(get_value(),number_of_decimals);
271 }
272 output << "°";
273 return output.str();
274 }
const float & get_value() const
Gets the value of the angle, in degrees.
Definition angle.hpp:102
string display_float(const float &value, int number_of_decimals)
Definition types.cpp:36

◆ get_degree()

float angle::get_degree ( ) const
inline

Gets the value of the angle in degrees.

Definition at line 201 of file angle.hpp.

202 {
203 return value;
204 }

◆ get_radian()

float angle::get_radian ( ) const
inline

Gets the value of the angle in radians.

Definition at line 206 of file angle.hpp.

207 {
208 return degree_to_radian(value);
209 }
float degree_to_radian(float x)
Converts a degree to a radian.
Definition angle.hpp:31

◆ get_value()

const float & angle::get_value ( ) const
inline

Gets the value of the angle, in degrees.

Definition at line 102 of file angle.hpp.

103 {
104 return value;
105 }

◆ initialize_from_string()

void angle::initialize_from_string ( string  init_angle)
protected

Internal function. Sets the value of the angle to a new value using the initialization string of angles.

Definition at line 297 of file angle.cpp.

298 {
299 if (init_angle.length() >= 5 and init_angle.substr(init_angle.length() - 4) == " deg")
300 {
301 value = stof(init_angle.substr(0,init_angle.length() - 4));
303 return;
304 }
305 else if (init_angle.length() >= 5 and init_angle.substr(init_angle.length() - 4) == " rad")
306 {
307 value = radian_to_degree(stof(init_angle.substr(0,init_angle.length() - 4)));
309 return;
310 }
311 else if (init_angle.length() >= 6 and init_angle.substr(init_angle.length() - 5) == " grad")
312 {
313 value = gradian_to_degree(stof(init_angle.substr(0,init_angle.length() - 5)));
315 return;
316 }
317 else if (init_angle.length() >= 4 and init_angle.substr(init_angle.length() - 3) == " tr")
318 {
319 value = turn_to_degree(stof(init_angle.substr(0,init_angle.length() - 3)));
321 return;
322 }
323 icu::UnicodeString init_angle_unicode = icu::UnicodeString(init_angle.c_str());
324 if (init_angle_unicode.endsWith(0x00B0) or init_angle_unicode.endsWith(0x00BA) or init_angle_unicode.endsWith(0x03B8) or init_angle_unicode.endsWith(0x03A6))
325 {
326 value = stof(init_angle);
328 }
329 }

◆ invert()

void angle::invert ( )

Inverts the angle to the opposite direction in a 2D plane, which is to add 180 degrees. The value is normalized after.

Definition at line 250 of file angle.cpp.

251 {
252 value += 180.0f;
254 }

◆ normalize_value()

void angle::normalize_value ( )
private

Internal function. Normalizes the value, which means to maintain the same angle within 0 and 360. If the value is lower or greather it gets converted to their equivalent counterpart within this range.

Definition at line 276 of file angle.cpp.

277 {
278 if(isfinite(value))
279 {
280 if (value >= 360.0f)
281 {
282 while (value >= 360.0f)
283 {
284 value -= 360.0f;
285 }
286 }
287 else if (value < 0.0f)
288 {
289 while (value < 0.0f)
290 {
291 value += 360.0f;
292 }
293 }
294 }
295 }

◆ operator float()

angle::operator float ( ) const
inlineexplicit

Cast angle to a float.

Definition at line 97 of file angle.hpp.

98 {
99 return float(value);
100 }

◆ operator*() [1/2]

angle angle::operator* ( const angle x) const

Creates a new angle as the multiplication of other two.

Definition at line 179 of file angle.cpp.

180 {
181 return angle(value * x.get_value());
182 }
angle()
Default constructor of angle. The value is set to 0.
Definition angle.cpp:18

◆ operator*() [2/2]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
angle angle::operator* ( T  x) const
inline

Creates a new angle as the multiplication of a numeric type with the value of this angle.

Definition at line 138 of file angle.hpp.

139 {
140 return angle(value * x);
141 }

◆ operator*=() [1/2]

void angle::operator*= ( const angle x)

Multiplies the value of this angle with the value of angle x. The value is normalized after.

Definition at line 206 of file angle.cpp.

207 {
208 value *= x.get_value();
210 }

◆ operator*=() [2/2]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
void angle::operator*= ( T  x)
inline

Multiplies a numeric type to the value of this angle.

Definition at line 170 of file angle.hpp.

171 {
172 value *= x;
174 }

◆ operator+() [1/2]

angle angle::operator+ ( const angle x) const

Creates a new angle as the sum of other two.

Definition at line 169 of file angle.cpp.

170 {
171 return angle(value + x.get_value());
172 }

◆ operator+() [2/2]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
angle angle::operator+ ( T  x) const
inline

Creates a new angle as the sum of a numeric type with the value of this angle.

Definition at line 126 of file angle.hpp.

127 {
128 return angle(value + x);
129 }

◆ operator++() [1/2]

angle & angle::operator++ ( )

Increments the value by one.

Definition at line 224 of file angle.cpp.

225 {
226 value++;
227 return *this;
228 }

◆ operator++() [2/2]

angle angle::operator++ ( int  )

Increments the value by one.

Definition at line 230 of file angle.cpp.

231 {
232 angle tmp = angle(*this);
233 operator ++();
234 return tmp;
235 }
angle & operator++()
Increments the value by one.
Definition angle.cpp:224

◆ operator+=() [1/2]

void angle::operator+= ( const angle x)

Sums the value of the angle x to the value of this angle. The value is normalized after.

Definition at line 194 of file angle.cpp.

195 {
196 value += x.get_value();
198 }

◆ operator+=() [2/2]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
void angle::operator+= ( T  x)
inline

Sums a numeric type to the value of this angle.

Definition at line 156 of file angle.hpp.

157 {
158 value += x;
160 }

◆ operator-() [1/2]

angle angle::operator- ( const angle x) const

Creates a new angle as the substraction of this angle and another angle x.

Definition at line 174 of file angle.cpp.

175 {
176 return angle(value - x.get_value());
177 }

◆ operator-() [2/2]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
angle angle::operator- ( T  x) const
inline

Creates a new angle as the substraction of the value of this angle with a numeric type.

Definition at line 132 of file angle.hpp.

133 {
134 return angle(value - x);
135 }

◆ operator--() [1/2]

angle & angle::operator-- ( )

Decrements the value by one.

Definition at line 237 of file angle.cpp.

238 {
239 value--;
240 return *this;
241 }

◆ operator--() [2/2]

angle angle::operator-- ( int  )

Decrements the value by one.

Definition at line 243 of file angle.cpp.

244 {
245 angle tmp = angle(*this);
246 operator --();
247 return tmp;
248 }
angle & operator--()
Decrements the value by one.
Definition angle.cpp:237

◆ operator-=() [1/2]

void angle::operator-= ( const angle x)

Substract the value of the angle x to the value of this angle. The value is normalized after.

Definition at line 200 of file angle.cpp.

201 {
202 value -= x.get_value();
204 }

◆ operator-=() [2/2]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
void angle::operator-= ( T  x)
inline

Substracts a numeric type to the value of this angle.

Definition at line 163 of file angle.hpp.

164 {
165 value -= x;
167 }

◆ operator/() [1/2]

angle angle::operator/ ( const angle x) const

Creates a new angle as the division of this angle and another angle x.

Definition at line 184 of file angle.cpp.

185 {
186 return angle(value / x.get_value());
187 }

◆ operator/() [2/2]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
angle angle::operator/ ( T  x) const
inline

Creates a new angle as the division of a numeric type with the value of this angle.

Definition at line 144 of file angle.hpp.

145 {
146 return angle(value / x);
147 }

◆ operator/=() [1/2]

void angle::operator/= ( const angle x)

Divides the value of this angle with the value of angle x. The value is normalized after.

Definition at line 212 of file angle.cpp.

213 {
214 value /= x.get_value();
216 }

◆ operator/=() [2/2]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
void angle::operator/= ( T  x)
inline

Divides a numeric type to the value of this angle.

Definition at line 177 of file angle.hpp.

178 {
179 value /= x;
181 }

◆ operator=() [1/6]

angle & angle::operator= ( angle &&  x)

Move assignment of angle. The value is moved from the value of angle x.

Definition at line 136 of file angle.cpp.

137 {
138 value = std::move(x.get_value());
139 return *this;
140 }

◆ operator=() [2/6]

angle & angle::operator= ( const angle x)

Copy assignment of angle. The value is copied to the value of angle x.

Definition at line 130 of file angle.cpp.

131 {
132 value = x.get_value();
133 return *this;
134 }

◆ operator=() [3/6]

angle & angle::operator= ( const scalar_unit x)

Assignment operator. The value of the angle is set to the value of the scalar_unit x, only if the scalar_unit has empty dimensions.

Definition at line 155 of file angle.cpp.

156 {
157 if (x.has_empty_dimensions())
158 {
159 value = x.get_value();
161 }
162 else
163 {
164 cerr << "An angle cannot be initialized with dimensions" << endl;
165 }
166 return *this;
167 }

◆ operator=() [4/6]

angle & angle::operator= ( const string init_angle)

Assignment operator. An initialization string is used to set the value, which contains the character 00B0 or the character 00BA to represent degrees.

Definition at line 149 of file angle.cpp.

150 {
151 initialize_from_string(init_angle);
152 return *this;
153 }

◆ operator=() [5/6]

angle & angle::operator= ( float  new_value)

Assignment operator. The value is copied from the float.

Definition at line 142 of file angle.cpp.

143 {
144 value = new_value;
146 return *this;
147 }

◆ operator=() [6/6]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
void angle::operator= ( T  new_value)
inline

Sets the value to the value of some numeric type, casting it to a float first, and normalizing the value after that.

Definition at line 119 of file angle.hpp.

120 {
121 value = float(new_value);
123 }

◆ operator^() [1/2]

angle angle::operator^ ( const angle x) const

Creates a new angle by powering the angle class with the value of another angle x.

Definition at line 189 of file angle.cpp.

190 {
191 return angle(std::pow(value,x.get_value()));
192 }

◆ operator^() [2/2]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
angle angle::operator^ ( T  x) const
inline

Creates a new angle as the power of the value of this angle with a numeric type.

Definition at line 150 of file angle.hpp.

151 {
152 return angle(std::pow(value, x));
153 }

◆ operator^=() [1/2]

void angle::operator^= ( const angle x)

Powers the value of this angle with the value of angle x. The value is normalized after.

Definition at line 218 of file angle.cpp.

219 {
220 value = std::pow(value,x.get_value());
222 }

◆ operator^=() [2/2]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
void angle::operator^= ( T  x)
inline

Powers a numeric type to the value of this angle.

Definition at line 184 of file angle.hpp.

185 {
186 value = std::pow(value, x);
188 }

◆ to_scalar_unit()

scalar_unit angle::to_scalar_unit ( ) const

Creates a scalar_unit with the same value and degree dimensions.

Definition at line 256 of file angle.cpp.

257 {
258 return scalar_unit(value, { dimension(dimension::DEGREE, prefix::NONE, dimension::NUMERATOR) });
259 }
@ NUMERATOR
The dimension is at the numerator.
Definition dimension.hpp:38
@ DEGREE
Degree, plural degrees. Dimension of angle. Symbol θ.
Definition dimension.hpp:35
@ NONE
There is no prefix. Then, the dimension is not increased or decreased by some factor.
Definition prefix.hpp:16

Member Data Documentation

◆ value

angle::value
protected

Value of the angle. It is stored in degrees.

Definition at line 212 of file angle.hpp.


The documentation for this class was generated from the following files: