1#ifndef SCIFIR_UNITS_UNITS_VECTOR_UNIT_ND_HPP_INCLUDED
2#define SCIFIR_UNITS_UNITS_VECTOR_UNIT_ND_HPP_INCLUDED
5#include "../meca_number/angle.hpp"
6#include "../util/is_number.hpp"
7#include "../coordinates/direction.hpp"
9#include "boost/algorithm/string.hpp"
19#define VECTOR_UNIT_ND_HPP_BEGIN(name) class name##_nd : public vector_unit_nd \
23 name##_nd(const name##_nd&); \
24 name##_nd(name##_nd&&); \
25 explicit name##_nd(float new_value, dimension::type new_dimension, prefix::type new_prefix, vector<float> new_angles,dimension::position new_position = dimension::NUMERATOR); \
26 explicit name##_nd(float new_value, dimension::type new_dimension, prefix::type new_prefix, const vector<angle>& new_angles, dimension::position new_position = dimension::NUMERATOR); \
27 explicit name##_nd(double new_value, dimension::type new_dimension, prefix::type new_prefix, vector<float> new_angles, dimension::position new_position = dimension::NUMERATOR); \
28 explicit name##_nd(double new_value, dimension::type new_dimension, prefix::type new_prefix, const vector<angle>& new_angles, dimension::position new_position = dimension::NUMERATOR); \
29 explicit name##_nd(long double new_value, dimension::type new_dimension, prefix::type new_prefix, vector<float> new_angles, dimension::position new_position = dimension::NUMERATOR); \
30 explicit name##_nd(long double new_value, dimension::type new_dimension, prefix::type new_prefix, const vector<angle>& new_angles, dimension::position new_position = dimension::NUMERATOR); \
31 explicit name##_nd(int new_value, dimension::type new_dimension, prefix::type new_prefix, vector<float> new_angles, dimension::position new_position = dimension::NUMERATOR); \
32 explicit name##_nd(int new_value, dimension::type new_dimension, prefix::type new_prefix, const vector<angle>& new_angles, dimension::position new_position = dimension::NUMERATOR); \
33 explicit name##_nd(float new_value,const string& init_dimensions); \
34 explicit name##_nd(float new_value,const string& init_dimensions,const vector<float>& new_angles); \
35 explicit name##_nd(float new_value,const string& init_dimensions,const vector<angle>& new_angles); \
36 explicit name##_nd(double new_value,const string& init_dimensions); \
37 explicit name##_nd(double new_value,const string& init_dimensions,const vector<float>& new_angles); \
38 explicit name##_nd(double new_value,const string& init_dimensions,const vector<angle>& new_angles); \
39 explicit name##_nd(long double new_value,const string& init_dimensions); \
40 explicit name##_nd(long double new_value,const string& init_dimensions,const vector<float>& new_angles); \
41 explicit name##_nd(long double new_value,const string& init_dimensions,const vector<angle>& new_angles); \
42 explicit name##_nd(int new_value,const string& init_dimensions); \
43 explicit name##_nd(int new_value,const string& init_dimensions,const vector<float>& new_angles); \
44 explicit name##_nd(int new_value,const string& init_dimensions,const vector<angle>& new_angles); \
45 explicit name##_nd(float new_value,const vector<dimension>& new_dimensions); \
46 explicit name##_nd(float new_value,const vector<dimension>& new_dimensions,const vector<float>& new_angles); \
47 explicit name##_nd(float new_value,const vector<dimension>& new_dimensions,const vector<angle>& new_angles); \
48 explicit name##_nd(double new_value,const vector<dimension>& new_dimensions); \
49 explicit name##_nd(double new_value,const vector<dimension>& new_dimensions,const vector<float>& new_angles); \
50 explicit name##_nd(double new_value,const vector<dimension>& new_dimensions,const vector<angle>& new_angles); \
51 explicit name##_nd(long double new_value,const vector<dimension>& new_dimensions); \
52 explicit name##_nd(long double new_value,const vector<dimension>& new_dimensions,const vector<float>& new_angles); \
53 explicit name##_nd(long double new_value,const vector<dimension>& new_dimensions,const vector<angle>& new_angles); \
54 explicit name##_nd(int new_value,const vector<dimension>& new_dimensions); \
55 explicit name##_nd(int new_value,const vector<dimension>& new_dimensions,const vector<float>& new_angles); \
56 explicit name##_nd(int new_value,const vector<dimension>& new_dimensions,const vector<angle>& new_angles); \
57 explicit name##_nd(const scalar_unit& x); \
58 explicit name##_nd(const scalar_unit& x,const vector<float>& new_angles); \
59 explicit name##_nd(const scalar_unit& x,const vector<angle>& new_angles); \
60 explicit name##_nd(const string& init_scalar,const vector<float>& new_angles); \
61 explicit name##_nd(const string& init_scalar,const vector<angle>& new_angles); \
62 explicit name##_nd(const string& init_vector_nd); \
63 explicit name##_nd(const vector_unit_nd& x); \
64 explicit name##_nd(vector_unit_nd&& x); \
65 name##_nd& operator =(const name##_nd& x); \
66 name##_nd& operator =(name##_nd&& x); \
67 using vector_unit_nd::operator =; \
68 using vector_unit_nd::operator+=; \
69 using vector_unit_nd::operator-=
71#define VECTOR_UNIT_ND_HPP_END() public: \
72 static const string dimensions_match; \
73 static const vector<dimension> real_dimensions; \
76#define VECTOR_UNIT_ND_HPP(name) class name##_nd : public vector_unit_nd \
80 name##_nd(const name##_nd&); \
81 name##_nd(name##_nd&&); \
82 explicit name##_nd(float new_value, dimension::type new_dimension, prefix::type new_prefix, vector<float> new_angles,dimension::position new_position = dimension::NUMERATOR); \
83 explicit name##_nd(float new_value, dimension::type new_dimension, prefix::type new_prefix, const vector<angle>& new_angles, dimension::position new_position = dimension::NUMERATOR); \
84 explicit name##_nd(double new_value, dimension::type new_dimension, prefix::type new_prefix, vector<float> new_angles, dimension::position new_position = dimension::NUMERATOR); \
85 explicit name##_nd(double new_value, dimension::type new_dimension, prefix::type new_prefix, const vector<angle>& new_angles, dimension::position new_position = dimension::NUMERATOR); \
86 explicit name##_nd(long double new_value, dimension::type new_dimension, prefix::type new_prefix, vector<float> new_angles, dimension::position new_position = dimension::NUMERATOR); \
87 explicit name##_nd(long double new_value, dimension::type new_dimension, prefix::type new_prefix, const vector<angle>& new_angles, dimension::position new_position = dimension::NUMERATOR); \
88 explicit name##_nd(int new_value, dimension::type new_dimension, prefix::type new_prefix, vector<float> new_angles, dimension::position new_position = dimension::NUMERATOR); \
89 explicit name##_nd(int new_value, dimension::type new_dimension, prefix::type new_prefix, const vector<angle>& new_angles, dimension::position new_position = dimension::NUMERATOR); \
90 explicit name##_nd(float new_value,const string& init_dimensions); \
91 explicit name##_nd(float new_value,const string& init_dimensions,const vector<float>& new_angles); \
92 explicit name##_nd(float new_value,const string& init_dimensions,const vector<angle>& new_angles); \
93 explicit name##_nd(double new_value,const string& init_dimensions); \
94 explicit name##_nd(double new_value,const string& init_dimensions,const vector<float>& new_angles); \
95 explicit name##_nd(double new_value,const string& init_dimensions,const vector<angle>& new_angles); \
96 explicit name##_nd(long double new_value,const string& init_dimensions); \
97 explicit name##_nd(long double new_value,const string& init_dimensions,const vector<float>& new_angles); \
98 explicit name##_nd(long double new_value,const string& init_dimensions,const vector<angle>& new_angles); \
99 explicit name##_nd(int new_value,const string& init_dimensions); \
100 explicit name##_nd(int new_value,const string& init_dimensions,const vector<float>& new_angles); \
101 explicit name##_nd(int new_value,const string& init_dimensions,const vector<angle>& new_angles); \
102 explicit name##_nd(float new_value,const vector<dimension>& new_dimensions); \
103 explicit name##_nd(float new_value,const vector<dimension>& new_dimensions,const vector<float>& new_angles); \
104 explicit name##_nd(float new_value,const vector<dimension>& new_dimensions,const vector<angle>& new_angles); \
105 explicit name##_nd(double new_value,const vector<dimension>& new_dimensions); \
106 explicit name##_nd(double new_value,const vector<dimension>& new_dimensions,const vector<float>& new_angles); \
107 explicit name##_nd(double new_value,const vector<dimension>& new_dimensions,const vector<angle>& new_angles); \
108 explicit name##_nd(long double new_value,const vector<dimension>& new_dimensions); \
109 explicit name##_nd(long double new_value,const vector<dimension>& new_dimensions,const vector<float>& new_angles); \
110 explicit name##_nd(long double new_value,const vector<dimension>& new_dimensions,const vector<angle>& new_angles); \
111 explicit name##_nd(int new_value,const vector<dimension>& new_dimensions); \
112 explicit name##_nd(int new_value,const vector<dimension>& new_dimensions,const vector<float>& new_angles); \
113 explicit name##_nd(int new_value,const vector<dimension>& new_dimensions,const vector<angle>& new_angles); \
114 explicit name##_nd(const scalar_unit& x); \
115 explicit name##_nd(const scalar_unit& x,const vector<float>& new_angles); \
116 explicit name##_nd(const scalar_unit& x,const vector<angle>& new_angles); \
117 explicit name##_nd(const string& init_scalar,const vector<float>& new_angles); \
118 explicit name##_nd(const string& init_scalar,const vector<angle>& new_angles); \
119 explicit name##_nd(const string& init_vector_nd); \
120 explicit name##_nd(const vector_unit_nd& x); \
121 explicit name##_nd(vector_unit_nd&& x); \
122 name##_nd& operator =(const name##_nd& x); \
123 name##_nd& operator =(name##_nd&& x); \
124 using vector_unit_nd::operator =; \
125 using vector_unit_nd::operator+=; \
126 using vector_unit_nd::operator-=; \
128 static const string dimensions_match; \
129 static const vector<dimension> real_dimensions; \
132#define VECTOR_UNIT_ND_CPP(name,init_real_dimensions) name##_nd::name##_nd() : vector_unit_nd() {} \
133 name##_nd::name##_nd(const name##_nd& x) : vector_unit_nd(x) {} \
134 name##_nd::name##_nd(name##_nd&& x) : vector_unit_nd(std::move(x)) {} \
135 name##_nd::name##_nd(float new_value, dimension::type new_dimension, prefix::type new_prefix, vector<float> new_angles, dimension::position new_position) : vector_unit_nd(new_value,new_dimension,new_prefix,new_angles,new_position) \
137 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
138 for(const float& x_angle : new_angles) \
140 angles.push_back(angle(x_angle)); \
144 name##_nd::name##_nd(float new_value, dimension::type new_dimension, prefix::type new_prefix, const vector<angle>& new_angles, dimension::position new_position) : vector_unit_nd(new_value,new_dimension,new_prefix,new_angles,new_position) \
146 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
149 name##_nd::name##_nd(double new_value, dimension::type new_dimension, prefix::type new_prefix, vector<float> new_angles, dimension::position new_position) : vector_unit_nd(new_value,new_dimension,new_prefix,new_angles,new_position) \
151 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
152 for(const float& x_angle : new_angles) \
154 angles.push_back(angle(x_angle)); \
158 name##_nd::name##_nd(double new_value, dimension::type new_dimension, prefix::type new_prefix, const vector<angle>& new_angles, dimension::position new_position) : vector_unit_nd(new_value,new_dimension,new_prefix,new_angles,new_position) \
160 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
163 name##_nd::name##_nd(long double new_value, dimension::type new_dimension, prefix::type new_prefix, vector<float> new_angles, dimension::position new_position) : vector_unit_nd(new_value,new_dimension,new_prefix,new_angles,new_position) \
165 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
166 for(const float& x_angle : new_angles) \
168 angles.push_back(angle(x_angle)); \
172 name##_nd::name##_nd(long double new_value, dimension::type new_dimension, prefix::type new_prefix, const vector<angle>& new_angles, dimension::position new_position) : vector_unit_nd(new_value,new_dimension,new_prefix,new_angles,new_position) \
174 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
177 name##_nd::name##_nd(int new_value, dimension::type new_dimension, prefix::type new_prefix, vector<float> new_angles, dimension::position new_position) : vector_unit_nd(new_value,new_dimension,new_prefix,new_angles,new_position) \
179 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
180 for(const float& x_angle : new_angles) \
182 angles.push_back(angle(x_angle)); \
186 name##_nd::name##_nd(int new_value, dimension::type new_dimension, prefix::type new_prefix, const vector<angle>& new_angles, dimension::position new_position) : vector_unit_nd(new_value,new_dimension,new_prefix,new_angles,new_position) \
188 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
191 name##_nd::name##_nd(float new_value,const string& init_dimensions) : vector_unit_nd(new_value,init_dimensions) \
193 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
196 name##_nd::name##_nd(float new_value,const string& init_dimensions,const vector<float>& new_angles) : vector_unit_nd(new_value,init_dimensions) \
198 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
199 for(const float& x_angle : new_angles) \
201 angles.push_back(angle(x_angle)); \
205 name##_nd::name##_nd(float new_value,const string& init_dimensions,const vector<angle>& new_angles) : vector_unit_nd(new_value,init_dimensions,new_angles) \
207 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
210 name##_nd::name##_nd(double new_value,const string& init_dimensions) : vector_unit_nd(new_value,init_dimensions) \
212 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
215 name##_nd::name##_nd(double new_value,const string& init_dimensions,const vector<float>& new_angles) : vector_unit_nd(new_value,init_dimensions) \
217 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
218 for(const float& x_angle : new_angles) \
220 angles.push_back(angle(x_angle)); \
224 name##_nd::name##_nd(double new_value,const string& init_dimensions,const vector<angle>& new_angles) : vector_unit_nd(new_value,init_dimensions,new_angles) \
226 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
229 name##_nd::name##_nd(long double new_value,const string& init_dimensions) : vector_unit_nd(new_value,init_dimensions) \
231 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
234 name##_nd::name##_nd(long double new_value,const string& init_dimensions,const vector<float>& new_angles) : vector_unit_nd(new_value,init_dimensions) \
236 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
237 for(const float& x_angle : new_angles) \
239 angles.push_back(angle(x_angle)); \
243 name##_nd::name##_nd(long double new_value,const string& init_dimensions,const vector<angle>& new_angles) : vector_unit_nd(new_value,init_dimensions,new_angles) \
245 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
248 name##_nd::name##_nd(int new_value,const string& init_dimensions) : vector_unit_nd(new_value,init_dimensions) \
250 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
253 name##_nd::name##_nd(int new_value,const string& init_dimensions,const vector<float>& new_angles) : vector_unit_nd(new_value,init_dimensions) \
255 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
256 for(const float& x_angle : new_angles) \
258 angles.push_back(angle(x_angle)); \
262 name##_nd::name##_nd(int new_value,const string& init_dimensions,const vector<angle>& new_angles) : vector_unit_nd(new_value,init_dimensions,new_angles) \
264 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
267 name##_nd::name##_nd(float new_value,const vector<dimension>& new_dimensions) : vector_unit_nd(new_value,new_dimensions) \
269 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
272 name##_nd::name##_nd(float new_value,const vector<dimension>& new_dimensions,const vector<float>& new_angles) : vector_unit_nd(new_value,new_dimensions) \
274 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
275 for(const float& x_angle : new_angles) \
277 angles.push_back(angle(x_angle)); \
281 name##_nd::name##_nd(float new_value,const vector<dimension>& new_dimensions,const vector<angle>& new_angles) : vector_unit_nd(new_value,new_dimensions,new_angles) \
283 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
286 name##_nd::name##_nd(double new_value,const vector<dimension>& new_dimensions) : vector_unit_nd(new_value,new_dimensions) \
288 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
291 name##_nd::name##_nd(double new_value,const vector<dimension>& new_dimensions,const vector<float>& new_angles) : vector_unit_nd(new_value,new_dimensions) \
293 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
294 for(const float& x_angle : new_angles) \
296 angles.push_back(angle(x_angle)); \
300 name##_nd::name##_nd(double new_value,const vector<dimension>& new_dimensions,const vector<angle>& new_angles) : vector_unit_nd(new_value,new_dimensions,new_angles) \
302 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
305 name##_nd::name##_nd(long double new_value,const vector<dimension>& new_dimensions) : vector_unit_nd(new_value,new_dimensions) \
307 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
310 name##_nd::name##_nd(long double new_value,const vector<dimension>& new_dimensions,const vector<float>& new_angles) : vector_unit_nd(new_value,new_dimensions) \
312 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
313 for(const float& x_angle : new_angles) \
315 angles.push_back(angle(x_angle)); \
319 name##_nd::name##_nd(long double new_value,const vector<dimension>& new_dimensions,const vector<angle>& new_angles) : vector_unit_nd(new_value,new_dimensions,new_angles) \
321 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
324 name##_nd::name##_nd(int new_value,const vector<dimension>& new_dimensions) : vector_unit_nd(new_value,new_dimensions) \
326 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
329 name##_nd::name##_nd(int new_value,const vector<dimension>& new_dimensions,const vector<float>& new_angles) : vector_unit_nd(new_value,new_dimensions) \
331 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
332 for(const float& x_angle : new_angles) \
334 angles.push_back(angle(x_angle)); \
338 name##_nd::name##_nd(int new_value,const vector<dimension>& new_dimensions,const vector<angle>& new_angles) : vector_unit_nd(new_value,new_dimensions,new_angles) \
340 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
343 name##_nd::name##_nd(const scalar_unit& x) : vector_unit_nd(x) \
345 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
348 name##_nd::name##_nd(const scalar_unit& x,const vector<float>& new_angles) : vector_unit_nd(x) \
350 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
351 for(const float& x_angle : new_angles) \
353 angles.push_back(angle(x_angle)); \
357 name##_nd::name##_nd(const scalar_unit& x,const vector<angle>& new_angles) : vector_unit_nd(x,new_angles) \
359 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
362 name##_nd::name##_nd(const string& init_scalar,const vector<float>& new_angles) : vector_unit_nd(init_scalar) \
364 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
365 for(const float& x_angle : new_angles) \
367 angles.push_back(angle(x_angle)); \
371 name##_nd::name##_nd(const string& init_scalar,const vector<angle>& new_angles) : vector_unit_nd(init_scalar,new_angles) \
373 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
376 name##_nd::name##_nd(const string& init_vector_nd) : vector_unit_nd() \
378 vector_unit_nd::initialize_from_string(init_vector_nd); \
381 name##_nd::name##_nd(const vector_unit_nd& x) : vector_unit_nd(x) \
383 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
386 name##_nd::name##_nd(vector_unit_nd&& x) : vector_unit_nd(x) \
388 scalar_unit::check_dimensions(name##_nd::real_dimensions); \
391 name##_nd& name##_nd::operator =(const name##_nd& x) \
393 vector_unit_nd::operator =(x); \
397 name##_nd& name##_nd::operator =(name##_nd&& x) \
399 vector_unit_nd::operator =(std::move(x)); \
402const string name##_nd::dimensions_match = init_real_dimensions; \
403const vector<dimension> name##_nd::real_dimensions = create_base_dimensions(init_real_dimensions)
568 return angles.size() == (
i - 1);
608template<typename T, typename = typename enable_if<scifir::is_number<T>::value>::type>
616template<typename T, typename = typename enable_if<scifir::is_number<T>::value>::type>
622template<typename T, typename = typename enable_if<scifir::is_number<T>::value>::type>
630template<typename T, typename = typename enable_if<scifir::is_number<T>::value>::type>
636 new_dimension.invert();
Class that allows to work with angles. Each angle sizes 4 bytes. Initialization string example: "20°"...
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.
const float & get_value() const
Read-only getter of the value.
Class that creates a vector in ND, which means a variable number of dimensions. A vector_unit_nd can ...
vector_unit_nd()
Default constructor. The value is 0, the dimensions are empty and the angles are empty.
scalar_unit n_projection(int i) const
Returns the x projection, the y projection or the z projection, depending if i is 1 (it returns x),...
string vectorial_display(int number_of_decimals=2) const
Displays the vector as the string representation of the scalar unit adding also all the angles.
vector_unit_nd & operator=(const vector_unit_nd &x)
Copy assignment. The member-variables are copied from vector_unit_nd x.
void operator+=(const vector_unit_nd &x)
The vector_unit_nd is summed as vector in 2D, 3D, or more coordinates. It's summed as scalar in 1D.
int get_nd() const
Returns the number of dimensions.
bool is_nd(unsigned int i) const
Returns true if the vector is at the same number of dimensions as i.
bool operator==(vector_unit_nd x) const
Comparison operator. Two vector_unit_nd are equal if their value, dimensions and angles are the same.
vector< angle > angles
The angles. A total of one angle means the vector is in 2D in polar coordinates, two angles means it'...
string vectorial_base_display(int number_of_decimals=2) const
Displays the vector as the string representation of the scalar unit adding also all the angles....
scalar_unit x_projection() const
It creates the x projection of the vector, returning it as a scalar_unit of the same dimensions,...
vector_unit_nd operator+(const vector_unit_nd &x) const
Addition of vectors in 2D, 3D, or more coordinates. It's an addition of scalars in 1D....
void operator/=(T x)
It divides the numeric type x to the value. The angles are not changed.
scalar_unit y_projection() const
It creates the y projection of the vector, returning it as a scalar_unit of the same dimensions,...
vector_unit_nd 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 operator-=(vector_unit_nd x)
The vector_unit_nd is substracted as vector in 2D, 3D, or more coordinates. It's substracted as scala...
static vector_unit_nd 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,...
static vector_unit_nd 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,...
vector_unit_nd operator-(vector_unit_nd x) const
Substraction of vectors in 2D, 3D, or more coordinates. It's a substraction of scalars in 1D....
void point_to(direction::name x)
The angles are set to the direction specified in 1D, 2D or 3D, depending on the current ND of vector_...
vector_unit_nd operator*(const scalar_unit &x) const
It creates a new vector_unit_nd scaling a vector_unit_nd by the scalar_unit x.
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 all the angles....
vector_unit_nd operator^(const scalar_unit &x) const
It powers a vector by a scalar_unit x if that scalar_unit has empty dimensions.
void operator*=(T x)
It multiplies the numeric type x to the value. The angles are not changed.
static vector_unit_nd cartesian_2d(const string &init_dimensions, float new_x, float new_y)
The dimensions are initialized from the initialization string of dimensions new_dimensions,...
void initialize_from_string(string init_vector_nd)
Initializes the member-variables with the initialization string of vector_unit_nd init_vector_nd.
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.
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.
bool same_nd(const vector_unit_nd &x, const vector_unit_nd &y)
Checks if two vectors have the same number of dimensions.
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.
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.
bool operator!=(const scifir::vector_unit_nd &x, const scifir::vector_unit_nd &y)
Comparison operator. Two vector_unit_nd are not equal if their value, dimensions or angles are differ...
istream & operator>>(istream &is, scifir::vector_unit_nd &x)
Allows that an istream initializes by string a vector_unit_nd x.
scifir::vector_unit_nd operator-(const T y, const scifir::vector_unit_nd &x)
It creates a new vector as the substraction of the numeric type x to the value. The angles are not ch...
bool operator==(const scifir::vector_unit_nd &x, const string &init_vector_nd)
Returns true if x is equal to the vector_unit_nd initialized with the string being compared....
scifir::vector_unit_nd operator*(const scifir::scalar_unit &x, const scifir::vector_unit_nd &y)
It creates a new vector_unitn3d scaling a vector_unit_nd by the scalar_unit x.
ostream & operator<<(ostream &os, const scifir::vector_unit_nd &x)
Adds the string representation of the vector_unit_nd x to an output stream os.
scifir::vector_unit_nd operator+(const T y, const scifir::vector_unit_nd &x)
It creates a new vector as the addition of the numeric type x to the value. The angles are not change...
scifir::vector_unit_nd operator/(const T y, const scifir::vector_unit_nd &x)
It creates a new vector as the division of the value with the numeric type x. The angles are not chan...
void operator+=(string &x, const scifir::vector_unit_nd &y)
Concatenates the string representation of the vector_unit_nd y to the string x.