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
|
#include <latitude.hpp>
Public Types | |
enum | position : int8_t { NORTH , SOUTH , CENTER } |
![]() | |
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 | |
latitude () | |
latitude (const latitude &x) | |
latitude (latitude &&x) | |
latitude (float new_value) | |
latitude (double new_value) | |
latitude (long double new_value) | |
latitude (int new_value) | |
latitude (const string &init_latitude) | |
latitude (const scalar_unit &x) | |
latitude (const angle &x) | |
latitude & | operator= (const latitude &x) |
latitude & | operator= (latitude &&x) |
latitude & | operator= (float new_value) |
latitude & | operator= (const string &init_latitude) |
latitude & | operator= (const scalar_unit &x) |
latitude::position | get_position () const |
void | invert () |
![]() | |
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. | |
angle & | operator= (const angle &x) |
Copy assignment of angle. The value is copied to the value of angle x. | |
angle & | operator= (angle &&x) |
Move assignment of angle. The value is moved from the value of angle x. | |
angle & | operator= (float new_value) |
Assignment operator. The value is copied from the float. | |
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. | |
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. | |
operator float () const | |
Cast angle to a float. | |
const float & | get_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. | |
angle & | operator++ () |
Increments the value by one. | |
angle | operator++ (int) |
Increments the value by one. | |
angle & | operator-- () |
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. | |
Private Member Functions | |
void | normalize_value () |
void | initialize_from_angle (const angle &x) |
void | initialize_from_string (string init_latitude) |
Additional Inherited Members | |
![]() | |
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. | |
![]() | |
float | value |
Value of the angle. It is stored in degrees. | |
Definition at line 16 of file latitude.hpp.
scifir::latitude::latitude | ( | ) |
Definition at line 18 of file latitude.cpp.
Definition at line 21 of file latitude.cpp.
scifir::latitude::latitude | ( | latitude && | x | ) |
Definition at line 24 of file latitude.cpp.
|
explicit |
Definition at line 27 of file latitude.cpp.
|
explicit |
Definition at line 33 of file latitude.cpp.
Definition at line 39 of file latitude.cpp.
|
explicit |
Definition at line 45 of file latitude.cpp.
Definition at line 51 of file latitude.cpp.
|
explicit |
Definition at line 56 of file latitude.cpp.
Definition at line 70 of file latitude.cpp.
latitude::position scifir::latitude::get_position | ( | ) | const |
Definition at line 114 of file latitude.cpp.
Definition at line 158 of file latitude.cpp.
Definition at line 174 of file latitude.cpp.
void scifir::latitude::invert | ( | ) |
|
private |
Definition at line 75 of file latitude.cpp.
latitude & scifir::latitude::operator= | ( | const scalar_unit & | x | ) |
Definition at line 100 of file latitude.cpp.
Definition at line 94 of file latitude.cpp.
Definition at line 87 of file latitude.cpp.
Definition at line 81 of file latitude.cpp.