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
|
Class that creates a vector unit in 2D. The vector is in polar coordinates with a value and dimensions of the scalar_unit, and an angle theta for his direction. All base and derived vectorial unit classes in 2D inherit from vector_unit_2d, and add the suffix **_2d** in their name. Initialization string example: "1 N 20θ". 'θ' is the Unicode Character U+03B8. More...
#include <vector_unit_2d.hpp>
Public Member Functions | |
vector_unit_2d () | |
Default constructor. The value is set to 0, the dimensions are empty and theta is 0. | |
vector_unit_2d (const vector_unit_2d &x) | |
Copy constructor. The member-variables are copied from the vector_unit_2d x. | |
vector_unit_2d (vector_unit_2d &&x) | |
Move constructor. The member-variables are moved from the vector_unit_2d x. | |
vector_unit_2d (float new_value, dimension::type new_dimension, prefix::type new_prefix, float new_theta, dimension::position new_position=dimension::NUMERATOR) | |
vector_unit_2d (float new_value, dimension::type new_dimension, prefix::type new_prefix, const angle &new_theta, dimension::position new_position=dimension::NUMERATOR) | |
vector_unit_2d (double new_value, dimension::type new_dimension, prefix::type new_prefix, float new_theta, dimension::position new_position=dimension::NUMERATOR) | |
vector_unit_2d (double new_value, dimension::type new_dimension, prefix::type new_prefix, const angle &new_theta, dimension::position new_position=dimension::NUMERATOR) | |
vector_unit_2d (long double new_value, dimension::type new_dimension, prefix::type new_prefix, float new_theta, dimension::position new_position=dimension::NUMERATOR) | |
vector_unit_2d (long double new_value, dimension::type new_dimension, prefix::type new_prefix, const angle &new_theta, dimension::position new_position=dimension::NUMERATOR) | |
vector_unit_2d (int new_value, dimension::type new_dimension, prefix::type new_prefix, float new_theta, dimension::position new_position=dimension::NUMERATOR) | |
vector_unit_2d (int new_value, dimension::type new_dimension, prefix::type new_prefix, const angle &new_theta, dimension::position new_position=dimension::NUMERATOR) | |
vector_unit_2d (float new_value, const string &init_dimensions, float new_theta) | |
The value is new_value, the dimensions are initialized with the initialization string of dimensions, and theta is new_theta. | |
vector_unit_2d (float new_value, const string &init_dimensions, const angle &new_theta) | |
The value is new_value, the dimensions are initialized with the initialization string of dimensions, and theta is new_theta. | |
vector_unit_2d (double new_value, const string &init_dimensions, float new_theta) | |
The value is new_value (the double is casted to a float), the dimensions are initialized with the initialization string of dimensions, and theta is new_theta. | |
vector_unit_2d (double new_value, const string &init_dimensions, const angle &new_theta) | |
The value is new_value (the double is casted to a float), the dimensions are initialized with the initialization string of dimensions, and theta is new_theta. | |
vector_unit_2d (long double new_value, const string &init_dimensions, float new_theta) | |
The value is new_value (the long double is casted to a float), the dimensions are initialized with the initialization string of dimensions, and theta is new_theta. | |
vector_unit_2d (long double new_value, const string &init_dimensions, const angle &new_theta) | |
The value is new_value (the long double is casted to a float), the dimensions are initialized with the initialization string of dimensions, and theta is new_theta. | |
vector_unit_2d (int new_value, const string &init_dimensions, float new_theta) | |
The value is new_value (the int is casted to a float), the dimensions are initialized with the initialization string of dimensions, and theta is new_theta. | |
vector_unit_2d (int new_value, const string &init_dimensions, const angle &new_theta) | |
The value is new_value (the int is casted to a float), the dimensions are initialized with the initialization string of dimensions, and theta is new_theta. | |
vector_unit_2d (float new_value, const vector< dimension > &new_dimensions, float new_theta) | |
The value is new_value, the dimensions are initialized with a vector of dimensions, and theta is new_theta. | |
vector_unit_2d (float new_value, const vector< dimension > &new_dimensions, const angle &new_theta) | |
The value is new_value, the dimensions are initialized with a vector of dimensions, and theta is new_theta. | |
vector_unit_2d (double new_value, const vector< dimension > &new_dimensions, float new_theta) | |
The value is new_value (the double is casted to a float), the dimensions are initialized with a vector of dimensions, and theta is new_theta. | |
vector_unit_2d (double new_value, const vector< dimension > &new_dimensions, const angle &new_theta) | |
The value is new_value (the double is casted to a float), the dimensions are initialized with a vector of dimensions, and theta is new_theta. | |
vector_unit_2d (long double new_value, const vector< dimension > &new_dimensions, float new_theta) | |
The value is new_value (the long double is casted to a float), the dimensions are initialized with a vector of dimensions, and theta is new_theta. | |
vector_unit_2d (long double new_value, const vector< dimension > &new_dimensions, const angle &new_theta) | |
The value is new_value (the long double is casted to a float), the dimensions are initialized with a vector of dimensions, and theta is new_theta. | |
vector_unit_2d (int new_value, const vector< dimension > &new_dimensions, float new_theta) | |
The value is new_value (the int is casted to a float), the dimensions are initialized with a vector of dimensions, and theta is new_theta. | |
vector_unit_2d (int new_value, const vector< dimension > &new_dimensions, const angle &new_theta) | |
The value is new_value (the int is casted to a float), the dimensions are initialized with a vector of dimensions, and theta is new_theta. | |
vector_unit_2d (const scalar_unit &x, float new_theta) | |
The value and the dimensions are copied from the scalar_unit x, theta is new_theta. | |
vector_unit_2d (const scalar_unit &x, const angle &new_theta) | |
The value and the dimensions are copied from the scalar_unit x, theta is new_theta. | |
vector_unit_2d (const string &init_scalar, float new_theta) | |
The value and the dimensions are copied from the initialization string of scalar_unit init_scalar, theta is new_theta. | |
vector_unit_2d (const string &init_scalar, const angle &new_theta) | |
The value and the dimensions are copied from the initialization string of scalar_unit init_scalar, theta is new_theta. | |
vector_unit_2d (const string &init_vector_2d) | |
The value, the dimensions and theta are initialized from the initialization string of vector_unit_2d init_vector_2d. | |
vector_unit_2d & | operator= (const vector_unit_2d &x) |
Copy assignment. The member-variables are copied from the vector_unit_2d x. | |
vector_unit_2d & | operator= (vector_unit_2d &&x) |
Move assignment. The member-variables are moved from the vector_unit_2d x. | |
vector_unit_2d & | operator= (const scalar_unit &x) |
The value and the dimensions are copied from the scalar_unit x, theta is not changed. | |
vector_unit_2d & | operator= (scalar_unit &&x) |
The value and the dimensions are moved from the scalar_unit x, theta is not changed. | |
vector_unit_2d & | operator= (const string &init_vector_2d) |
The value, the dimensions and theta are set from the initialization string init_vector_2d. | |
bool | operator== (vector_unit_2d x) const |
Comparison operator. Two vector_unit_2d are equal if their value, dimensions and theta are the same. | |
void | point_to (direction::name x) |
Theta is set to the direction specified in 2D. Possible values are LEFT, RIGHT, TOP, BOTTOM, LEFT_TOP, RIGHT_TOP, RIGHT_BOTTOM, LEFT_BOTTOM. | |
void | operator+= (const vector_unit_2d &x) |
The vector_unit_2d is summed as vector, in polar coordinates. The addition of vectors is used for the calculation. | |
void | operator-= (vector_unit_2d x) |
The vector_unit_2d is substracted as vector, in polar coordinates. The substraction of vectors is used for the calculation. | |
vector_unit_2d | operator+ (const vector_unit_2d &x) const |
Addition of vectors in 2D. It creates a new vector as the addition of the other two. | |
vector_unit_2d | operator- (vector_unit_2d x) const |
Substraction of vectors in 2D. It creates a new vector as the difference of the other two. | |
vector_unit_2d | operator* (const scalar_unit &x) const |
It creates a new vector_unit_2d scaling a vector_unit_2d by the scalar_unit x. | |
vector_unit_2d | operator/ (const scalar_unit &x) const |
It creates a new vector_unit_2d scaling a vector_unit_2d by the inverse of the scalar_unit x. | |
vector_unit_2d | operator^ (const scalar_unit &x) const |
It powers a vector by a scalar_unit x if that scalar_unit has empty dimensions. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
vector_unit_2d | operator+ (T x) const |
It creates a new vector as the addition of the numeric type x to the value. Theta is not changed. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
vector_unit_2d | operator- (T x) const |
It creates a new vector as the substraction of the numeric type x to the value. Theta is not changed. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
vector_unit_2d | operator* (T x) const |
It creates a new vector as the multiplication of the numeric type x to the value. Theta is not changed. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
vector_unit_2d | operator/ (T x) const |
It creates a new vector as the division of the numeric type x to the value. Theta is not changed. | |
template<typename T , typename = typename enable_if<is_integer_number<T>::value>::type> | |
vector_unit_2d | operator^ (T x) const |
It creates a new vector as the power of the numeric type x to the value. Theta is not changed. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
void | operator+= (T x) |
It sums the numeric type x to the value. Theta is not changed. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
void | operator-= (T x) |
It substracts the numeric type x to the value. Theta is not changed. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
void | operator*= (T x) |
It multiplies the numeric type x to the value. Theta is not changed. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
void | operator/= (T x) |
It divides the numeric type x to the value. Theta is not changed. | |
scalar_unit | x_projection () const |
It creates the x projection of the vector, returning it as a scalar_unit of the same dimensions, and the value corresponds to the projection. | |
scalar_unit | y_projection () const |
It creates the y projection of the vector, returning it as a scalar_unit of the same dimensions, and the value corresponds to the projection. | |
void | invert () |
Changes the direction of the vector to the opposite direction. It does that by adding 180 degrees to theta. | |
string | vectorial_display (int number_of_decimals=2) const |
Displays the vector as the string representation of the scalar unit adding also the angle theta. | |
string | vectorial_base_display (int number_of_decimals=2) const |
Displays the vector as the string representation of the scalar unit adding also the angle theta. It displays the dimensions with its base dimensions. | |
string | vectorial_custom_display (const string &init_dimensions, int number_of_decimals=2) const |
Displays the vector as the string representation of the scalar unit adding also the angle theta. It displays the vector in the dimensions specified in the initialization string of dimensions init_dimensions. | |
![]() | |
scalar_unit () | |
Default constructor, the value is 0 and the dimensions are empty. | |
scalar_unit (const scalar_unit &x) | |
Copy constructor, copies the value and the dimensions. | |
scalar_unit (scalar_unit &&x) | |
Move constructor, moves the value and the dimensions. | |
scalar_unit (float new_value, dimension::type new_dimension, prefix::type new_prefix, dimension::position new_position=dimension::NUMERATOR) | |
scalar_unit (double new_value, dimension::type new_dimension, prefix::type new_prefix, dimension::position new_position=dimension::NUMERATOR) | |
scalar_unit (long double new_value, dimension::type new_dimension, prefix::type new_prefix, dimension::position new_position=dimension::NUMERATOR) | |
scalar_unit (int new_value, dimension::type new_dimension, prefix::type new_prefix, dimension::position new_position=dimension::NUMERATOR) | |
scalar_unit (float new_value, const string &init_dimensions) | |
Creates a new scalar_unit with the value and with the dimensions specified in the string. | |
scalar_unit (double new_value, const string &init_dimensions) | |
Creates a new scalar_unit, the double is casted to a float. | |
scalar_unit (long double new_value, const string &init_dimensions) | |
Creates a new scalar_unit, the long double is casted to a float. | |
scalar_unit (int new_value, const string &init_dimensions) | |
Creates a new scalar_unit, the int is casted to a float. | |
scalar_unit (float new_value, const vector< dimension > &new_dimensions) | |
Creates a new scalar_unit with the value given and copying the dimensions. | |
scalar_unit (double new_value, const vector< dimension > &new_dimensions) | |
Creates a new scalar_unit, the double is casted to a float, the dimensions are copied. | |
scalar_unit (long double new_value, const vector< dimension > &new_dimensions) | |
Creates a new scalar_unit, the long double is casted to a float, the dimensions are copied. | |
scalar_unit (int new_value, const vector< dimension > &new_dimensions) | |
Creates a new scalar_unit, the int is casted to a float, the dimensions are copied. | |
scalar_unit (const string &init_scalar) | |
Creates a new scalar_unit, the initialization string specifies both the value and the dimensions. | |
scalar_unit & | operator= (const scalar_unit &x) |
Copy assignment, it assigns a copy of the scalar_unit. | |
scalar_unit & | operator= (scalar_unit &&x) |
Move assignment, it moves the scalar_unit. | |
scalar_unit & | operator= (const string &init_scalar) |
Assignment with an initialization string, the value and the dimensions are both specified. | |
operator float () const | |
Cast the scalar_unit to their float equivalent, it discards the dimensions and copies the value to a float. | |
bool | operator== (scalar_unit x) const |
Comparison operator, two scalar_unit classes are considered equivalent if they have the same value given the same dimensions. | |
scalar_unit | operator+ (scalar_unit x) const |
Addition operator, it sums two scalar_unit classes, their dimensions are changed to be equal first. If the basic dimensions are different, it returns an empty scalar_unit class. | |
scalar_unit | operator- (scalar_unit x) const |
Substraction operator, it substracts one scalar_unit from the other, their dimensions are changed to be equal first. If the basic dimensions are different, it returns an empty scalar_unit class. | |
scalar_unit | operator* (scalar_unit x) const |
Multiplication operator, it multiplies two scalar_unit classes, their dimensions are also multiplied. | |
scalar_unit | operator/ (scalar_unit x) const |
Division operator, it divides one scalar_unit class with the other, their dimensions are also divided. | |
scalar_unit | operator^ (const scalar_unit &x) const |
Power operator, it powers a scalar_unit class with another, if that second scalar_unit class, which is the exponent, as empty dimensions. If the exponent doesn't has empty dimensions it returns an empty scalar_unit class. | |
void | operator+= (scalar_unit x) |
Addition operator, it adds a scalar_unit class to another, by converting their dimensions to be equal first. If their basic dimensions are different, it doesn't sums to the value. | |
void | operator-= (scalar_unit x) |
Substraction operator, it substracts a scalar_unit class to another, by converting their dimensions to be equal first. If their basic dimensions are different, it doesn't substracts to the value. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
scalar_unit | operator+ (T y) const |
Addition operator, it sums the numeric type to the value, independent of the dimensions. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
scalar_unit | operator- (T y) const |
Substraction operator, it substracts the numeric type to the value, independent of the dimensions. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
scalar_unit | operator* (T y) const |
Multiplication operator, it multiplies the numeric type with the value, independent of the dimensions. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
scalar_unit | operator/ (T y) const |
Division operator, it divides the value with the numeric type, independent of the dimensions. | |
template<typename T , typename = typename enable_if<is_integer_number<T>::value>::type> | |
scalar_unit | operator^ (T y) const |
Power operator, it powers the value with the numeric type, independent of the dimensions. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
void | operator+= (T y) |
Addition operator, it adds the numeric type to the value, independent of the dimensions. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
void | operator-= (T y) |
Substraction operator, it substracts the numeric type to the value, independent of the dimensions. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
void | operator*= (T y) |
Multiplication operator, it multiplies the numeric type to the value, independent of the dimensions. | |
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type> | |
void | operator/= (T y) |
Division operator, it divides the numeric type to the value, independent of the dimensions. | |
scalar_unit & | operator++ () |
Increment operator, it increases the value by one. | |
scalar_unit & | operator++ (int) |
Increment operator, it increases the value by one. | |
scalar_unit & | operator-- () |
Decrement operator, it decreases the value by one. | |
scalar_unit & | operator-- (int) |
Decrement operator, it decreases the value by one. | |
void | change_dimensions (const string &init_dimensions) |
Changes the dimensions to the dimensions specified by the initialization string of dimensions. | |
void | change_dimensions (const scalar_unit &x) |
Changes the dimensions to the same dimensions of the scalar_unit. | |
bool | has_dimensions (const string &init_dimensions) const |
Checks if the basic dimensions are the same as the initialization string of dimensions. | |
bool | has_dimensions (const vector< dimension > &x_dimensions) const |
Checks if the basic dimensions are the same as some set of dimensions. | |
bool | has_dimensions (const scalar_unit &x) const |
Checks if the basic dimensions are the same as other scalar_unit. | |
bool | has_empty_dimensions () const |
Checks if there aren't base dimensions. | |
bool | is_dimensionless () const |
Returns true if there aren't dimensions or if all dimensions are dimensionless. | |
bool | has_simple_dimensions () const |
Returns true if there's only a simple dimension. | |
bool | has_single_dimensions () const |
Returns true if there's only one dimension, which can be simple or composite. | |
bool | has_composite_dimensions () const |
Returns true is there's more than one simple dimension. | |
string | display_dimensions () const |
Generates an string of the dimensions of the scalar_unit, with the same format as the initialization string of dimensions. | |
dimension::type | get_single_dimension_type () const |
Returns the dimension::type if there's only one dimension, returns dimension::NONE if there's more than one dimension or if the dimensions are empty. | |
vector< dimension > | get_base_dimensions () const |
Generates a set of the base dimensions of the dimensions of the scalar_unit. | |
const vector< dimension > & | get_dimensions () const |
Read-only getter of the dimensions. | |
const float & | get_value () const |
Read-only getter of the value. | |
string | display (int number_of_decimals=2, bool with_brackets=false, bool use_close_prefix=false) const |
Generates a string representation of the scalar_unit, with the value and the dimensions. The dimensions can be enclosed by brackets, and the value can be set to have the closest prefix. | |
string | base_display (int number_of_decimals=2, bool with_brackets=false, bool use_close_prefix=false) const |
Generates a string representation of the scalar_unit, with its dimensions converted to their base counterpart. | |
string | custom_display (const string &init_dimensions, int number_of_decimals=2, bool with_brackets=false) const |
Generates a string representation of the scalar_unit, with the dimensions changed to any set of dimensions, specified by an initialization string of dimensions. | |
string | to_latex (const string &init_dimensions, int number_of_decimals=2, bool with_brackets=false) const |
Static Public Member Functions | |
static vector_unit_2d | cartesian_2d (const string &init_dimensions, float new_x, float new_y) |
The dimensions are initialized from the initialization string of dimensions new_dimensions, the cartesian coordinates new_x and new_y are converted to polar coordinates and then set the value and theta. | |
Public Attributes | |
angle | theta |
Angle of the vector in 2D space, in polar coordinates. As all angles of scifir-units, it's stored in degrees. | |
Protected Member Functions | |
void | initialize_from_string (string init_vector_2d) |
Initializes the member-variables with the initialization string of vector_unit_2d init_vector_2d. | |
![]() | |
void | add_dimension (const dimension &new_dimension) |
Internal function. It adds a dimension, changing the value according to the conversion factor of the added dimension and the prefix. | |
void | remove_dimension (const dimension &old_dimension) |
Internal function. It removes a dimension, changing the value according to the conversion factor of the removed dimension and the prefix. | |
void | initialize_from_string (string init_scalar, const vector< dimension > &real_dimensions) |
Internal function. It sets the value and the dimensions of the scalar_unit to the value and dimensions specified by the initialization string of scalar_unit. | |
void | check_dimensions (const vector< dimension > &real_dimensions) |
Additional Inherited Members | |
![]() | |
vector< dimension > | dimensions |
Dimensions of the scalar_unit. They can be simple dimensions, composite dimensions or special names. | |
float | value |
Value of the scalar_unit. It changes automatically when the dimensions change. | |
Class that creates a vector unit in 2D. The vector is in polar coordinates with a value and dimensions of the scalar_unit, and an angle theta for his direction. All base and derived vectorial unit classes in 2D inherit from vector_unit_2d, and add the suffix **_2d** in their name. Initialization string example: "1 N 20θ". 'θ' is the Unicode Character U+03B8.
Definition at line 295 of file vector_unit_2d.hpp.
vector_unit_2d::vector_unit_2d | ( | ) |
Default constructor. The value is set to 0, the dimensions are empty and theta is 0.
Definition at line 12 of file vector_unit_2d.cpp.
vector_unit_2d::vector_unit_2d | ( | const vector_unit_2d & | x | ) |
Copy constructor. The member-variables are copied from the vector_unit_2d x.
Definition at line 15 of file vector_unit_2d.cpp.
vector_unit_2d::vector_unit_2d | ( | vector_unit_2d && | x | ) |
Move constructor. The member-variables are moved from the vector_unit_2d x.
Definition at line 18 of file vector_unit_2d.cpp.
|
explicit |
Definition at line 21 of file vector_unit_2d.cpp.
|
explicit |
Definition at line 24 of file vector_unit_2d.cpp.
|
explicit |
Definition at line 27 of file vector_unit_2d.cpp.
|
explicit |
Definition at line 30 of file vector_unit_2d.cpp.
|
explicit |
Definition at line 33 of file vector_unit_2d.cpp.
|
explicit |
Definition at line 36 of file vector_unit_2d.cpp.
|
explicit |
Definition at line 39 of file vector_unit_2d.cpp.
|
explicit |
Definition at line 42 of file vector_unit_2d.cpp.
|
explicit |
The value is new_value, the dimensions are initialized with the initialization string of dimensions, and theta is new_theta.
Definition at line 45 of file vector_unit_2d.cpp.
|
explicit |
The value is new_value, the dimensions are initialized with the initialization string of dimensions, and theta is new_theta.
Definition at line 48 of file vector_unit_2d.cpp.
|
explicit |
The value is new_value (the double is casted to a float), the dimensions are initialized with the initialization string of dimensions, and theta is new_theta.
Definition at line 51 of file vector_unit_2d.cpp.
|
explicit |
The value is new_value (the double is casted to a float), the dimensions are initialized with the initialization string of dimensions, and theta is new_theta.
Definition at line 54 of file vector_unit_2d.cpp.
|
explicit |
The value is new_value (the long double is casted to a float), the dimensions are initialized with the initialization string of dimensions, and theta is new_theta.
Definition at line 57 of file vector_unit_2d.cpp.
|
explicit |
The value is new_value (the long double is casted to a float), the dimensions are initialized with the initialization string of dimensions, and theta is new_theta.
Definition at line 60 of file vector_unit_2d.cpp.
|
explicit |
The value is new_value (the int is casted to a float), the dimensions are initialized with the initialization string of dimensions, and theta is new_theta.
Definition at line 63 of file vector_unit_2d.cpp.
|
explicit |
The value is new_value (the int is casted to a float), the dimensions are initialized with the initialization string of dimensions, and theta is new_theta.
Definition at line 66 of file vector_unit_2d.cpp.
|
explicit |
The value is new_value, the dimensions are initialized with a vector of dimensions, and theta is new_theta.
Definition at line 69 of file vector_unit_2d.cpp.
|
explicit |
The value is new_value, the dimensions are initialized with a vector of dimensions, and theta is new_theta.
Definition at line 72 of file vector_unit_2d.cpp.
|
explicit |
The value is new_value (the double is casted to a float), the dimensions are initialized with a vector of dimensions, and theta is new_theta.
Definition at line 75 of file vector_unit_2d.cpp.
|
explicit |
The value is new_value (the double is casted to a float), the dimensions are initialized with a vector of dimensions, and theta is new_theta.
Definition at line 78 of file vector_unit_2d.cpp.
|
explicit |
The value is new_value (the long double is casted to a float), the dimensions are initialized with a vector of dimensions, and theta is new_theta.
Definition at line 81 of file vector_unit_2d.cpp.
|
explicit |
The value is new_value (the long double is casted to a float), the dimensions are initialized with a vector of dimensions, and theta is new_theta.
Definition at line 84 of file vector_unit_2d.cpp.
|
explicit |
The value is new_value (the int is casted to a float), the dimensions are initialized with a vector of dimensions, and theta is new_theta.
Definition at line 87 of file vector_unit_2d.cpp.
|
explicit |
The value is new_value (the int is casted to a float), the dimensions are initialized with a vector of dimensions, and theta is new_theta.
Definition at line 90 of file vector_unit_2d.cpp.
|
explicit |
The value and the dimensions are copied from the scalar_unit x, theta is new_theta.
Definition at line 93 of file vector_unit_2d.cpp.
|
explicit |
The value and the dimensions are copied from the scalar_unit x, theta is new_theta.
Definition at line 96 of file vector_unit_2d.cpp.
The value and the dimensions are copied from the initialization string of scalar_unit init_scalar, theta is new_theta.
Definition at line 99 of file vector_unit_2d.cpp.
The value and the dimensions are copied from the initialization string of scalar_unit init_scalar, theta is new_theta.
Definition at line 102 of file vector_unit_2d.cpp.
The value, the dimensions and theta are initialized from the initialization string of vector_unit_2d init_vector_2d.
Definition at line 105 of file vector_unit_2d.cpp.
|
inlinestatic |
The dimensions are initialized from the initialization string of dimensions new_dimensions, the cartesian coordinates new_x and new_y are converted to polar coordinates and then set the value and theta.
Definition at line 331 of file vector_unit_2d.hpp.
Initializes the member-variables with the initialization string of vector_unit_2d init_vector_2d.
Definition at line 334 of file vector_unit_2d.cpp.
|
inline |
Changes the direction of the vector to the opposite direction. It does that by adding 180 degrees to theta.
Definition at line 438 of file vector_unit_2d.hpp.
vector_unit_2d vector_unit_2d::operator* | ( | const scalar_unit & | x | ) | const |
It creates a new vector_unit_2d scaling a vector_unit_2d by the scalar_unit x.
Definition at line 252 of file vector_unit_2d.cpp.
|
inline |
It creates a new vector as the multiplication of the numeric type x to the value. Theta is not changed.
Definition at line 375 of file vector_unit_2d.hpp.
It multiplies the numeric type x to the value. Theta is not changed.
Definition at line 409 of file vector_unit_2d.hpp.
vector_unit_2d vector_unit_2d::operator+ | ( | const vector_unit_2d & | x | ) | const |
Addition of vectors in 2D. It creates a new vector as the addition of the other two.
Definition at line 219 of file vector_unit_2d.cpp.
|
inline |
It creates a new vector as the addition of the numeric type x to the value. Theta is not changed.
Definition at line 359 of file vector_unit_2d.hpp.
void vector_unit_2d::operator+= | ( | const vector_unit_2d & | x | ) |
The vector_unit_2d is summed as vector, in polar coordinates. The addition of vectors is used for the calculation.
Definition at line 191 of file vector_unit_2d.cpp.
It sums the numeric type x to the value. Theta is not changed.
Definition at line 397 of file vector_unit_2d.hpp.
|
inline |
It creates a new vector as the substraction of the numeric type x to the value. Theta is not changed.
Definition at line 367 of file vector_unit_2d.hpp.
vector_unit_2d vector_unit_2d::operator- | ( | vector_unit_2d | x | ) | const |
Substraction of vectors in 2D. It creates a new vector as the difference of the other two.
Definition at line 235 of file vector_unit_2d.cpp.
It substracts the numeric type x to the value. Theta is not changed.
Definition at line 403 of file vector_unit_2d.hpp.
void vector_unit_2d::operator-= | ( | vector_unit_2d | x | ) |
The vector_unit_2d is substracted as vector, in polar coordinates. The substraction of vectors is used for the calculation.
Definition at line 206 of file vector_unit_2d.cpp.
vector_unit_2d vector_unit_2d::operator/ | ( | const scalar_unit & | x | ) | const |
It creates a new vector_unit_2d scaling a vector_unit_2d by the inverse of the scalar_unit x.
Definition at line 259 of file vector_unit_2d.cpp.
|
inline |
It creates a new vector as the division of the numeric type x to the value. Theta is not changed.
Definition at line 383 of file vector_unit_2d.hpp.
It divides the numeric type x to the value. Theta is not changed.
Definition at line 419 of file vector_unit_2d.hpp.
vector_unit_2d & vector_unit_2d::operator= | ( | const scalar_unit & | x | ) |
The value and the dimensions are copied from the scalar_unit x, theta is not changed.
Definition at line 124 of file vector_unit_2d.cpp.
vector_unit_2d & vector_unit_2d::operator= | ( | const string & | init_vector_2d | ) |
The value, the dimensions and theta are set from the initialization string init_vector_2d.
Definition at line 136 of file vector_unit_2d.cpp.
vector_unit_2d & vector_unit_2d::operator= | ( | const vector_unit_2d & | x | ) |
Copy assignment. The member-variables are copied from the vector_unit_2d x.
Definition at line 110 of file vector_unit_2d.cpp.
vector_unit_2d & vector_unit_2d::operator= | ( | scalar_unit && | x | ) |
The value and the dimensions are moved from the scalar_unit x, theta is not changed.
Definition at line 130 of file vector_unit_2d.cpp.
vector_unit_2d & vector_unit_2d::operator= | ( | vector_unit_2d && | x | ) |
Move assignment. The member-variables are moved from the vector_unit_2d x.
Definition at line 117 of file vector_unit_2d.cpp.
bool vector_unit_2d::operator== | ( | scifir::vector_unit_2d | x | ) | const |
Comparison operator. Two vector_unit_2d are equal if their value, dimensions and theta are the same.
Definition at line 142 of file vector_unit_2d.cpp.
vector_unit_2d vector_unit_2d::operator^ | ( | const scalar_unit & | x | ) | const |
It powers a vector by a scalar_unit x if that scalar_unit has empty dimensions.
Definition at line 266 of file vector_unit_2d.cpp.
|
inline |
It creates a new vector as the power of the numeric type x to the value. Theta is not changed.
Definition at line 391 of file vector_unit_2d.hpp.
void vector_unit_2d::point_to | ( | direction::name | x | ) |
Theta is set to the direction specified in 2D. Possible values are LEFT, RIGHT, TOP, BOTTOM, LEFT_TOP, RIGHT_TOP, RIGHT_BOTTOM, LEFT_BOTTOM.
Definition at line 155 of file vector_unit_2d.cpp.
Displays the vector as the string representation of the scalar unit adding also the angle theta. It displays the dimensions with its base dimensions.
string vector_unit_2d::vectorial_custom_display | ( | const string & | init_dimensions, |
int | number_of_decimals = 2 |
||
) | const |
Displays the vector as the string representation of the scalar unit adding also the angle theta. It displays the vector in the dimensions specified in the initialization string of dimensions init_dimensions.
Displays the vector as the string representation of the scalar unit adding also the angle theta.
|
inline |
It creates the x projection of the vector, returning it as a scalar_unit of the same dimensions, and the value corresponds to the projection.
Definition at line 428 of file vector_unit_2d.hpp.
|
inline |
It creates the y projection of the vector, returning it as a scalar_unit of the same dimensions, and the value corresponds to the projection.
Definition at line 433 of file vector_unit_2d.hpp.
angle vector_unit_2d::theta |
Angle of the vector in 2D space, in polar coordinates. As all angles of scifir-units, it's stored in degrees.
Definition at line 447 of file vector_unit_2d.hpp.