1#ifndef SCIFIR_UNITS_UNITS_VECTOR_UNIT_3D_HPP_INCLUDED
2#define SCIFIR_UNITS_UNITS_VECTOR_UNIT_3D_HPP_INCLUDED
7#include "../meca_number/angle.hpp"
8#include "../util/is_number.hpp"
9#include "../coordinates/direction.hpp"
11#include "boost/algorithm/string.hpp"
21#define VECTOR_UNIT_3D_HPP_BEGIN(name) class name##_3d : public vector_unit_3d \
25 name##_3d(const name##_3d&); \
26 name##_3d(name##_3d&&); \
27 explicit name##_3d(float new_value, dimension::type new_dimension, prefix::type new_prefix, float new_theta, float new_phi,dimension::position new_position = dimension::NUMERATOR); \
28 explicit name##_3d(float new_value, dimension::type new_dimension, prefix::type new_prefix, const angle& new_theta, const angle& new_phi, dimension::position new_position = dimension::NUMERATOR); \
29 explicit name##_3d(double new_value, dimension::type new_dimension, prefix::type new_prefix, float new_theta, float new_phi, dimension::position new_position = dimension::NUMERATOR); \
30 explicit name##_3d(double new_value, dimension::type new_dimension, prefix::type new_prefix, const angle& new_theta, const angle& new_phi, dimension::position new_position = dimension::NUMERATOR); \
31 explicit name##_3d(long double new_value, dimension::type new_dimension, prefix::type new_prefix, float new_theta, float new_phi, dimension::position new_position = dimension::NUMERATOR); \
32 explicit name##_3d(long double new_value, dimension::type new_dimension, prefix::type new_prefix, const angle& new_theta, const angle& new_phi, dimension::position new_position = dimension::NUMERATOR); \
33 explicit name##_3d(int new_value, dimension::type new_dimension, prefix::type new_prefix, float new_theta, float new_phi, dimension::position new_position = dimension::NUMERATOR); \
34 explicit name##_3d(int new_value, dimension::type new_dimension, prefix::type new_prefix, const angle& new_theta, const angle& new_phi, dimension::position new_position = dimension::NUMERATOR); \
35 explicit name##_3d(float new_value,const string& init_dimensions,float new_theta,float new_phi); \
36 explicit name##_3d(float new_value,const string& init_dimensions,const angle& new_theta,const angle& new_phi); \
37 explicit name##_3d(double new_value,const string& init_dimensions,float new_theta,float new_phi); \
38 explicit name##_3d(double new_value,const string& init_dimensions,const angle& new_theta,const angle& new_phi); \
39 explicit name##_3d(long double new_value,const string& init_dimensions,float new_theta,float new_phi); \
40 explicit name##_3d(long double new_value,const string& init_dimensions,const angle& new_theta,const angle& new_phi); \
41 explicit name##_3d(int new_value,const string& init_dimensions,float new_theta,float new_phi); \
42 explicit name##_3d(int new_value,const string& init_dimensions,const angle& new_theta,const angle& new_phi); \
43 explicit name##_3d(float new_value,const vector<dimension>& new_dimensions,float new_theta,float new_phi); \
44 explicit name##_3d(float new_value,const vector<dimension>& new_dimensions,const angle& new_theta,const angle& new_phi); \
45 explicit name##_3d(double new_value,const vector<dimension>& new_dimensions,float new_theta,float new_phi); \
46 explicit name##_3d(double new_value,const vector<dimension>& new_dimensions,const angle& new_theta,const angle& new_phi); \
47 explicit name##_3d(long double new_value,const vector<dimension>& new_dimensions,float new_theta,float new_phi); \
48 explicit name##_3d(long double new_value,const vector<dimension>& new_dimensions,const angle& new_theta,const angle& new_phi); \
49 explicit name##_3d(int new_value,const vector<dimension>& new_dimensions,float new_theta,float new_phi); \
50 explicit name##_3d(int new_value,const vector<dimension>& new_dimensions,const angle& new_theta,const angle& new_phi); \
51 explicit name##_3d(const scalar_unit& x,float new_theta,float new_phi); \
52 explicit name##_3d(const scalar_unit& x,const angle& new_theta,const angle& new_phi); \
53 explicit name##_3d(const string& init_scalar,float new_theta,float new_phi); \
54 explicit name##_3d(const string& init_scalar,const angle& new_theta,const angle& new_phi); \
55 explicit name##_3d(const string& init_vector_3d); \
56 explicit name##_3d(const vector_unit_3d& init_vector_3d); \
57 explicit name##_3d(vector_unit_3d&& init_vector_3d); \
58 name##_3d& operator =(const name##_3d& x); \
59 name##_3d& operator =(name##_3d&& x); \
60 using vector_unit_3d::operator =; \
61 using vector_unit_3d::operator+=; \
62 using vector_unit_3d::operator-=
64#define VECTOR_UNIT_3D_HPP_END() public: \
65 static const string dimensions_match; \
66 static const vector<dimension> real_dimensions; \
69#define VECTOR_UNIT_3D_HPP(name) class name##_3d : public vector_unit_3d \
73 name##_3d(const name##_3d&); \
74 name##_3d(name##_3d&&); \
75 explicit name##_3d(float new_value, dimension::type new_dimension, prefix::type new_prefix, float new_theta, float new_phi,dimension::position new_position = dimension::NUMERATOR); \
76 explicit name##_3d(float new_value, dimension::type new_dimension, prefix::type new_prefix, const angle& new_theta, const angle& new_phi, dimension::position new_position = dimension::NUMERATOR); \
77 explicit name##_3d(double new_value, dimension::type new_dimension, prefix::type new_prefix, float new_theta, float new_phi, dimension::position new_position = dimension::NUMERATOR); \
78 explicit name##_3d(double new_value, dimension::type new_dimension, prefix::type new_prefix, const angle& new_theta, const angle& new_phi, dimension::position new_position = dimension::NUMERATOR); \
79 explicit name##_3d(long double new_value, dimension::type new_dimension, prefix::type new_prefix, float new_theta, float new_phi, dimension::position new_position = dimension::NUMERATOR); \
80 explicit name##_3d(long double new_value, dimension::type new_dimension, prefix::type new_prefix, const angle& new_theta, const angle& new_phi, dimension::position new_position = dimension::NUMERATOR); \
81 explicit name##_3d(int new_value, dimension::type new_dimension, prefix::type new_prefix, float new_theta, float new_phi, dimension::position new_position = dimension::NUMERATOR); \
82 explicit name##_3d(int new_value, dimension::type new_dimension, prefix::type new_prefix, const angle& new_theta, const angle& new_phi, dimension::position new_position = dimension::NUMERATOR); \
83 explicit name##_3d(float new_value,const string& init_dimensions,float new_theta,float new_phi); \
84 explicit name##_3d(float new_value,const string& init_dimensions,const angle& new_theta,const angle& new_phi); \
85 explicit name##_3d(double new_value,const string& init_dimensions,float new_theta,float new_phi); \
86 explicit name##_3d(double new_value,const string& init_dimensions,const angle& new_theta,const angle& new_phi); \
87 explicit name##_3d(long double new_value,const string& init_dimensions,float new_theta,float new_phi); \
88 explicit name##_3d(long double new_value,const string& init_dimensions,const angle& new_theta,const angle& new_phi); \
89 explicit name##_3d(int new_value,const string& init_dimensions,float new_theta,float new_phi); \
90 explicit name##_3d(int new_value,const string& init_dimensions,const angle& new_theta,const angle& new_phi); \
91 explicit name##_3d(float new_value,const vector<dimension>& new_dimensions,float new_theta,float new_phi); \
92 explicit name##_3d(float new_value,const vector<dimension>& new_dimensions,const angle& new_theta,const angle& new_phi); \
93 explicit name##_3d(double new_value,const vector<dimension>& new_dimensions,float new_theta,float new_phi); \
94 explicit name##_3d(double new_value,const vector<dimension>& new_dimensions,const angle& new_theta,const angle& new_phi); \
95 explicit name##_3d(long double new_value,const vector<dimension>& new_dimensions,float new_theta,float new_phi); \
96 explicit name##_3d(long double new_value,const vector<dimension>& new_dimensions,const angle& new_theta,const angle& new_phi); \
97 explicit name##_3d(int new_value,const vector<dimension>& new_dimensions,float new_theta,float new_phi); \
98 explicit name##_3d(int new_value,const vector<dimension>& new_dimensions,const angle& new_theta,const angle& new_phi); \
99 explicit name##_3d(const scalar_unit& x,float new_theta,float new_phi); \
100 explicit name##_3d(const scalar_unit& x,const angle& new_theta,const angle& new_phi); \
101 explicit name##_3d(const string& init_scalar,float new_theta,float new_phi); \
102 explicit name##_3d(const string& init_scalar,const angle& new_theta,const angle& new_phi); \
103 explicit name##_3d(const string& init_vector_3d); \
104 explicit name##_3d(const vector_unit_3d& init_vector_3d); \
105 explicit name##_3d(vector_unit_3d&& init_vector_3d); \
106 name##_3d& operator =(const name##_3d& x); \
107 name##_3d& operator =(name##_3d&& x); \
108 using vector_unit_3d::operator =; \
109 using vector_unit_3d::operator+=; \
110 using vector_unit_3d::operator-=; \
112 static const string dimensions_match; \
113 static const vector<dimension> real_dimensions; \
116#define VECTOR_UNIT_3D_CPP(name,init_real_dimensions) name##_3d::name##_3d() : vector_unit_3d() {} \
117 name##_3d::name##_3d(const name##_3d& x) : vector_unit_3d(x) {} \
118 name##_3d::name##_3d(name##_3d&& x) : vector_unit_3d(std::move(x)) {} \
119 name##_3d::name##_3d(float new_value, dimension::type new_dimension, prefix::type new_prefix, float new_theta, float new_phi, dimension::position new_position) : vector_unit_3d(new_value,new_dimension,new_prefix,new_theta,new_phi,new_position) \
121 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
124 name##_3d::name##_3d(float new_value, dimension::type new_dimension, prefix::type new_prefix, const angle& new_theta, const angle& new_phi, dimension::position new_position) : vector_unit_3d(new_value,new_dimension,new_prefix,new_theta,new_phi,new_position) \
126 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
129 name##_3d::name##_3d(double new_value, dimension::type new_dimension, prefix::type new_prefix, float new_theta, float new_phi, dimension::position new_position) : vector_unit_3d(new_value,new_dimension,new_prefix,new_theta,new_phi,new_position) \
131 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
134 name##_3d::name##_3d(double new_value, dimension::type new_dimension, prefix::type new_prefix, const angle& new_theta, const angle& new_phi, dimension::position new_position) : vector_unit_3d(new_value,new_dimension,new_prefix,new_theta,new_phi,new_position) \
136 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
139 name##_3d::name##_3d(long double new_value, dimension::type new_dimension, prefix::type new_prefix, float new_theta, float new_phi, dimension::position new_position) : vector_unit_3d(new_value,new_dimension,new_prefix,new_theta,new_phi,new_position) \
141 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
144 name##_3d::name##_3d(long double new_value, dimension::type new_dimension, prefix::type new_prefix, const angle& new_theta, const angle& new_phi, dimension::position new_position) : vector_unit_3d(new_value,new_dimension,new_prefix,new_theta,new_phi,new_position) \
146 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
149 name##_3d::name##_3d(int new_value, dimension::type new_dimension, prefix::type new_prefix, float new_theta, float new_phi, dimension::position new_position) : vector_unit_3d(new_value,new_dimension,new_prefix,new_theta,new_position) \
151 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
154 name##_3d::name##_3d(int new_value, dimension::type new_dimension, prefix::type new_prefix, const angle& new_theta, const angle& new_phi, dimension::position new_position) : vector_unit_3d(new_value,new_dimension,new_prefix,new_theta,new_phi,new_position) \
156 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
159 name##_3d::name##_3d(float new_value,const string& init_dimensions,float new_theta,float new_phi) : vector_unit_3d(new_value,init_dimensions,new_theta,new_phi) \
161 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
164 name##_3d::name##_3d(float new_value,const string& init_dimensions,const angle& new_theta,const angle& new_phi) : vector_unit_3d(new_value,init_dimensions,new_theta,new_phi) \
166 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
169 name##_3d::name##_3d(double new_value,const string& init_dimensions,float new_theta,float new_phi) : vector_unit_3d(new_value,init_dimensions,new_theta,new_phi) \
171 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
174 name##_3d::name##_3d(double new_value,const string& init_dimensions,const angle& new_theta,const angle& new_phi) : vector_unit_3d(new_value,init_dimensions,new_theta,new_phi) \
176 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
179 name##_3d::name##_3d(long double new_value,const string& init_dimensions,float new_theta,float new_phi) : vector_unit_3d(new_value,init_dimensions,new_theta,new_phi) \
181 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
184 name##_3d::name##_3d(long double new_value,const string& init_dimensions,const angle& new_theta,const angle& new_phi) : vector_unit_3d(new_value,init_dimensions,new_theta,new_phi) \
186 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
189 name##_3d::name##_3d(int new_value,const string& init_dimensions,float new_theta,float new_phi) : vector_unit_3d(new_value,init_dimensions,new_theta,new_phi) \
191 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
194 name##_3d::name##_3d(int new_value,const string& init_dimensions,const angle& new_theta,const angle& new_phi) : vector_unit_3d(new_value,init_dimensions,new_theta,new_phi) \
196 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
199 name##_3d::name##_3d(float new_value,const vector<dimension>& new_dimensions,float new_theta,float new_phi) : vector_unit_3d(new_value,new_dimensions,new_theta,new_phi) \
201 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
204 name##_3d::name##_3d(float new_value,const vector<dimension>& new_dimensions,const angle& new_theta,const angle& new_phi) : vector_unit_3d(new_value,new_dimensions,new_theta,new_phi) \
206 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
209 name##_3d::name##_3d(double new_value,const vector<dimension>& new_dimensions,float new_theta,float new_phi) : vector_unit_3d(new_value,new_dimensions,new_theta,new_phi) \
211 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
214 name##_3d::name##_3d(double new_value,const vector<dimension>& new_dimensions,const angle& new_theta,const angle& new_phi) : vector_unit_3d(new_value,new_dimensions,new_theta,new_phi) \
216 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
219 name##_3d::name##_3d(long double new_value,const vector<dimension>& new_dimensions,float new_theta,float new_phi) : vector_unit_3d(new_value,new_dimensions,new_theta,new_phi) \
221 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
224 name##_3d::name##_3d(long double new_value,const vector<dimension>& new_dimensions,const angle& new_theta,const angle& new_phi) : vector_unit_3d(new_value,new_dimensions,new_theta,new_phi) \
226 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
229 name##_3d::name##_3d(int new_value,const vector<dimension>& new_dimensions,float new_theta,float new_phi) : vector_unit_3d(new_value,new_dimensions,new_theta,new_phi) \
231 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
234 name##_3d::name##_3d(int new_value,const vector<dimension>& new_dimensions,const angle& new_theta,const angle& new_phi) : vector_unit_3d(new_value,new_dimensions,new_theta,new_phi) \
236 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
239 name##_3d::name##_3d(const scalar_unit& x,float new_theta,float new_phi) : vector_unit_3d(x,new_theta,new_phi) \
241 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
244 name##_3d::name##_3d(const scalar_unit& x,const angle& new_theta,const angle& new_phi) : vector_unit_3d(x,new_theta,new_phi) \
246 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
249 name##_3d::name##_3d(const string& init_scalar,float new_theta,float new_phi) : vector_unit_3d(init_scalar,new_theta,new_phi) \
251 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
254 name##_3d::name##_3d(const string& init_scalar,const angle& new_theta,const angle& new_phi) : vector_unit_3d(init_scalar,new_theta,new_phi) \
256 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
259 name##_3d::name##_3d(const string& init_vector_3d) : vector_unit_3d() \
261 vector_unit_3d::initialize_from_string(init_vector_3d); \
264 name##_3d::name##_3d(const vector_unit_3d& x) : vector_unit_3d(x) \
266 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
269 name##_3d::name##_3d(vector_unit_3d&& x) : vector_unit_3d(x) \
271 scalar_unit::check_dimensions(name##_3d::real_dimensions); \
274 name##_3d& name##_3d::operator =(const name##_3d& x) \
276 vector_unit_3d::operator =(x); \
280 name##_3d& name##_3d::operator =(name##_3d&& x) \
282 vector_unit_3d::operator =(std::move(x)); \
285const string name##_3d::dimensions_match = init_real_dimensions; \
286const vector<dimension> name##_3d::real_dimensions = create_base_dimensions(init_real_dimensions)
288#define VECTOR_UNIT_HPP(name) SCALAR_UNIT_HPP(name); \
289VECTOR_UNIT_2D_HPP(name); \
290VECTOR_UNIT_3D_HPP(name); \
291VECTOR_UNIT_ND_HPP(name)
293#define VECTOR_UNIT_CPP(name,init_real_dimensions) SCALAR_UNIT_CPP(name,init_real_dimensions); \
294VECTOR_UNIT_2D_CPP(name,init_real_dimensions); \
295VECTOR_UNIT_3D_CPP(name,init_real_dimensions); \
296VECTOR_UNIT_ND_CPP(name,init_real_dimensions)
489template<typename T, typename = typename enable_if<scifir::is_number<T>::value>::type>
497template<typename T, typename = typename enable_if<scifir::is_number<T>::value>::type>
503template<typename T, typename = typename enable_if<scifir::is_number<T>::value>::type>
511template<typename T, typename = typename enable_if<scifir::is_number<T>::value>::type>
517 new_dimension.invert();
Class that allows to work with angles. Each angle sizes 4 bytes. Initialization string example: "20°"...
void invert()
Inverts the angle to the opposite direction in a 2D plane, which is to add 180 degrees....
Class that represents dimensions of the SI system of units. Each dimension sizes 6 bytes,...
position
Represents the position of the dimension, which can be at the numerator or at the denominator....
@ NUMERATOR
The dimension is at the numerator.
type
Represents a dimension of the SI system of units. All the dimensions of the SI system of units are su...
type
Represents a prefix of the SI system of units. All the prefixes of the SI system of units are support...
Class that allows to create scalar units, which are composed of a value (as a float) and dimensions....
const vector< dimension > & get_dimensions() const
Read-only getter of the dimensions.
float value
Value of the scalar_unit. It changes automatically when the dimensions change.
scalar_unit()
Default constructor, the value is 0 and the dimensions are empty.
const float & get_value() const
Read-only getter of the value.
Class that creates a vector unit in 3D. The vector is in spherical coordinates with a value and dimen...
void operator+=(const vector_unit_3d &x)
The vector_unit_3d is summed as vector, in spherical coordinates. The addition of vectors is used for...
void operator-=(vector_unit_3d x)
The vector_unit_3d is substracted as vector, in spherical coordinates. The substraction of vectors is...
vector_unit_3d operator/(const scalar_unit &x) const
It creates a new vector_unit_3d scaling a vector_unit_3d by the inverse of the scalar_unit x.
void invert()
Changes the direction of the vector to the opposite direction. It does that by adding 180 degrees to ...
scalar_unit y_projection() const
It creates the y projection of the vector, returning it as a scalar_unit of the same dimensions,...
void initialize_from_string(string init_vector_3d)
Initializes the member-variables with the initialization string of vector_unit_3d init_vector_3d.
void point_to(direction::name x)
Theta is set to the direction specified in 3D. Possible values are LEFT, RIGHT, TOP,...
vector_unit_3d operator^(const scalar_unit &x) const
It powers a vector by a scalar_unit x if that scalar_unit has empty dimensions.
scalar_unit z_projection() const
It creates the z projection of the vector, returning it as a scalar_unit of the same 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 and t...
scalar_unit x_projection() const
It creates the x projection of the vector, returning it as a scalar_unit of the same dimensions,...
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 and t...
void operator/=(T x)
It divides the numeric type x to the value. Theta and phi are not changed.
vector_unit_3d & operator=(const vector_unit_3d &x)
Copy assignment. The member-variables are copied from the vector_unit_3d x.
vector_unit_3d()
Default constructor. The value is set to 0, the dimensions are empty and theta and phi are 0.
angle theta
Angle theta of the vector in 3D space, in spherical coordinates. As all angles of scifir-units,...
vector_unit_3d operator-(vector_unit_3d x) const
Substraction of vectors in 3D. It creates a new vector as the difference of the other two.
void operator*=(T x)
It multiplies the numeric type x to the value. Theta and phi are not changed.
bool operator==(vector_unit_3d x) const
Comparison operator. Two vector_unit_3d are equal if their value, dimensions, theta and phi are the s...
vector_unit_3d operator+(const vector_unit_3d &x) const
Addition of vectors in 3D. It creates a new vector as the addition of the other two.
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 and t...
vector_unit_3d operator*(const scalar_unit &x) const
It creates a new vector_unit_3d scaling a vector_unit_3d by the scalar_unit x.
static vector_unit_3d cartesian_3d(const string &init_dimensions, float new_x, float new_y, float new_z)
The dimensions are initialized from the initialization string of dimensions new_dimensions,...
angle phi
Angle phi of the vector in 3D space, in spherical coordinates. As all angles of scifir-units,...
static vector_unit_3d cylindrical(const string &init_dimensions, float new_p, angle new_theta, float new_z)
The dimensions are initialized from the initialization string of dimensions new_dimensions,...
The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
angle angle_between(const vector_unit_2d &x, const vector_unit_2d &y)
Returns the angle between two vectors x and y inside a 2D space.
angle sqrt_nth(const angle &x, int index)
Calculates the nth root of the angle x and returns that new angle.
bool same_direction(const vector_unit_2d &x, const vector_unit_2d &y)
Checks if two vectors x and y have the same direction.
float cos(const angle &x)
Calculates the cos of angle x. It uses the cos() function of the standard library of C++,...
bool orthogonal(const angle &x, const angle &y)
Checks if two angles in a 2D correspond to orthogonal lines (or orthogonal vectors).
float atan_degree(float x)
Calculates the atan receiving x in degrees. It uses the atan() function of the standard library of C+...
string to_string(const aid &x)
Creates a string representation of aid, it's for aid equivalent to the display() function of aid.
float acos_degree(float x)
Calculates the acos receiving x in degrees. It uses the acos() function of the standard library of C+...
scalar_unit dot_product(const vector_unit_2d &x, const vector_unit_2d &y)
Creates a scalar_unit as the dot product of the two vectors x and y.
vector_unit_3d cross_product(const vector_unit_3d &x, const vector_unit_3d &y)
Creates a vector_unit_3d as the cross product of the two vectors x and y.
scalar_unit norm(const vector_unit_2d &x)
It returns the value of the vector in polar coordinates, p.
float sin(const angle &x)
Calculates the sin of angle x. It uses the sin() function of the standard library of C++,...
angle sqrt(const angle &x)
Calculates the square root of the angle x and returns that new angle.
bool parallel(const angle &x, const angle &y)
Checks if two angles in a 2D correspond to parallel lines (or parallel vectors).
vector< dimension > power_dimensions(const vector< dimension > &x, int exponent)
Powers the dimensions by an exponent.
scifir::vector_unit_3d operator-(const T y, const scifir::vector_unit_3d &x)
It creates a new vector as the substraction of the numeric type x with the value. Theta and phi are n...
scifir::vector_unit_3d operator+(const T y, const scifir::vector_unit_3d &x)
It creates a new vector as the addition of the numeric type x to the value. Theta and phi are not cha...
bool operator==(const scifir::vector_unit_3d &x, const string &init_vector_3d)
Returns true if x is equal to the vector_unit_3d initialized with the string being compared....
scifir::vector_unit_3d operator*(const scifir::scalar_unit &x, const scifir::vector_unit_3d &y)
It creates a new vector_unit_3d scaling a vector_unit_3d by the scalar_unit x.
scifir::vector_unit_3d operator/(const T y, const scifir::vector_unit_3d &x)
It creates a new vector as the division of the numeric type x with the value. Theta and phi are not c...
istream & operator>>(istream &is, scifir::vector_unit_3d &x)
Allows that an istream initializes by string a vector_unit_3d x.
ostream & operator<<(ostream &os, const scifir::vector_unit_3d &x)
Adds the string representation of the vector_unit_3d x to an output stream os.
bool operator!=(const scifir::vector_unit_3d &x, const scifir::vector_unit_3d &y)
Comparison operator. Two vector_unit_3d are not equal if their value, dimensions, theta or phi are di...
void operator+=(string &x, const scifir::vector_unit_3d &y)
Concatenates the string representation of the vector_unit_3d y to the string x.