1#ifndef SCIFIR_UNITS_COORDINATES_COORDINATES_NDR_HPP_INCLUDED
2#define SCIFIR_UNITS_COORDINATES_COORDINATES_NDR_HPP_INCLUDED
5#include "../derived_units/physics_units.hpp"
6#include "../units/base_units.hpp"
7#include "../util/types.hpp"
19 template<
typename T = length>
28 if (x.values.size() == (x.angles.size() + 1))
37 if (x.values.size() == (x.angles.size() + 1))
39 values = std::move(x.values);
40 angles = std::move(x.angles);
1113 template<
typename T>
1125 if (x.values.size() == (x.angles.size() + 1))
1134 if (x.values.size() == (x.angles.size() + 1))
1136 values = std::move(x.values);
1137 angles = std::move(x.angles);
1912 for (
unsigned int i = 0;
i <
values.size();
i++)
1916 return std::sqrt(
x_T);
2149 template<
typename T>
2152 if (x.get_values().size() > 0)
2156 if (x.get_values().size() > 0)
2158 for (
int i = 0;
i < x.get_values().
size();
i++)
2160 out << x.get_value(
i);
2161 if ((
i + 1) != x.get_values().size())
2167 if (x.get_angles().size() > 0)
2170 for (
int i = 0;
i < x.get_angles().
size();
i++)
2172 out << x.get_angle(
i);
2173 if ((
i + 1) != x.get_angles().size())
2188 string to_string(
const coordinates_ndr<float>& x);
2190 template<
typename T,
typename U>
2193 if (x.get_nd() == y.get_nd())
2196 for (
int i = 0;
i < x.get_values().
size();
i++)
2208 float distance(
const coordinates_ndr<float>& x,
const coordinates_ndr<float>& y);
2210 template<
typename T,
typename U>
2213 if (x.get_nd() == y.get_nd())
2216 for (
int i = 0;
i < x.get_values().
size();
i++)
2228 float distance(
const coordinates_ndr<float>& x,
const coordinates_nd<float>& y);
2230 template<
typename T,
typename U>
2233 if (x.get_nd() == y.get_nd())
2236 for (
int i = 0;
i < x.values.size();
i++)
2248 float distance(
const coordinates_nd<float>& x,
const coordinates_ndr<float>& y);
2251template<
typename T,
typename U>
2254 for (
int i = 0; i < x.get_values().size(); i++)
2256 if (x.get_value(i) != y.get_value(i))
2261 for (
int i = 0; i < x.get_angles().size(); i++)
2263 if (x.get_angle(i) != y.get_angle(i))
2271template<
typename T,
typename U>
2277template<
typename T,
typename U>
2280 if (x.get_values().size() == y.values.size())
2282 for (
int i = 0 ; i < x.get_values().size(); i++)
2284 if (x.get_value(i) != y.values[i])
2297template<
typename T,
typename U>
2303template<
typename T,
typename U>
2306 if (x.values.size() == y.get_values().size())
2308 for (
int i = 0 ; i < x.values.size(); i++)
2310 if (x.values[i] != y.get_value(i))
2323template<
typename T,
typename U>
2339 return !(x == init_coordinates_ndr);
2352 return !(init_coordinates_ndr == x);
2364 return x + to_string(y);
2370 return to_string(x) + y;
2376 return os << to_string(x);
Class that allows to work with angles. Each angle sizes 4 bytes. Initialization string example: "20°"...
float distance_to_origin() const
coordinates_ndr(const vector< float > &new_values, const vector< angle > &new_angles)
angle get_spherical_theta() const
void rotate_in_2d(const angle &new_theta)
coordinates_ndr(float new_x)
void move(float new_x, float new_y)
float & get_value(unsigned int i)
coordinates_ndr(coordinates_nd< float > &&new_coordinates, const vector< angle > &new_angles)
angle & get_angle(unsigned int i)
const angle & get_angle(unsigned int i) const
string display_polar() const
void change_nd(const vector< float > &new_values, const vector< float > &new_angles)
void set_position(float new_p, const angle &new_theta)
coordinates_ndr(float new_r, const angle &new_spherical_theta, const angle &new_spherical_phi, const angle &new_theta, const angle &new_phi)
coordinates_ndr(coordinates_nd< float > &&new_coordinates, const vector< float > &new_angles)
longitude get_longitude() const
coordinates_ndr(const coordinates_nd< float > &new_coordinates, const vector< angle > &new_angles)
coordinates_ndr(const vector< float > &new_values, const vector< float > &new_angles)
string display_cartesian_3d() const
const vector< float > & get_values() const
coordinates_ndr(float new_p, const angle &new_polar_theta, const angle &new_theta)
string display_geographical() const
void set_values(const vector< float > &new_values)
void move(float new_r, const vector< angle > &new_angles)
coordinates_ndr(const angle &new_latitude, const angle &new_longitude, float new_altitude, const angle &new_theta, const angle &new_phi)
void move(float new_r, const angle &new_theta, const angle &new_phi)
string display_cartesian_2d() const
void set_angles(const vector< float > &new_angles)
void set_position(float new_x, float new_y)
angle get_spherical_phi() const
latitude get_latitude() const
coordinates_ndr(const string &init_coordinates_ndr)
const vector< angle > & get_angles() const
void set_angles(const vector< angle > &new_angles)
coordinates_ndr(float new_x, float new_y, float new_z, const angle &new_theta, const angle &new_phi)
void initialize_from_string(string init_coordinates_ndr)
float get_altitude() const
const float & get_value(unsigned int i) const
void change_nd(const vector< float > &new_values, const vector< angle > &new_angles)
coordinates_ndr(const coordinates_nd< float > &new_coordinates, const vector< float > &new_angles)
coordinates_ndr(float new_p, const angle &new_cylindrical_theta, float new_z, const angle &new_theta, const angle &new_phi)
void set_position(float new_x)
void set_position(float new_p, const angle &new_theta, float new_z)
void set_position(float new_x, float new_y, float new_z)
void move(float new_p, const angle &new_theta, float new_z)
string display_cylindrical() const
void move(float new_p, const angle &new_theta)
coordinates_ndr(coordinates_ndr< float > &&x)
string display_spherical() const
void move(float new_x, float new_y, float new_z)
void set_position(const angle &new_latitude, const angle &new_longitude, float new_altitude)
bool is_nd(unsigned int i) const
coordinates_ndr(const coordinates_ndr< float > &x)
void move(const displacement_3d &x_displacement)
coordinates_ndr(float new_x, float new_y, const angle &new_theta)
void move(const displacement_2d &x_displacement)
void move(const displacement_nd &x_displacement)
void point_to(direction::name x)
void set_position(const vector< float > &new_values)
void set_position(float new_r, const angle &new_theta, const angle &new_phi)
void rotate_in_3d(int axis, const angle &new_theta)
coordinates_ndr(const vector< U > &new_values, const vector< angle > &new_angles)
void change_nd(const vector< scalar_unit > &new_values, const vector< angle > &new_angles)
coordinates_ndr(const scalar_unit &new_p, const angle &new_polar_theta, const angle &new_theta)
void move(const displacement_nd &x_displacement)
void initialize_from_string(string init_coordinates_ndr)
const angle & get_angle(int i) const
void set_position(const scalar_unit &new_x)
coordinates_ndr(coordinates_nd< U > &&new_coordinates, const vector< float > &new_angles)
coordinates_ndr(const coordinates_nd< U > &new_coordinates, const vector< angle > &new_angles)
string display_geographical() const
const vector< angle > & get_angles() const
coordinates_ndr(const scalar_unit &new_x, const scalar_unit &new_y, const angle &new_theta)
coordinates_ndr(const vector< U > &new_values, const vector< float > &new_angles)
void set_position(const scalar_unit &new_p, const angle &new_theta)
string display_cylindrical() const
coordinates_ndr(coordinates_ndr< T > &&x)
coordinates_ndr(const scalar_unit &new_p, const angle &new_cylindrical_theta, scalar_unit new_z, const angle &new_theta, const angle &new_phi)
void set_position(const scalar_unit &new_p, const angle &new_theta, scalar_unit new_z)
void move(const scalar_unit &new_p, const angle &new_theta, scalar_unit new_z)
coordinates_ndr(const coordinates_nd< U > &new_coordinates, const vector< float > &new_angles)
void move(const scalar_unit &new_r, const vector< angle > &new_angles)
coordinates_ndr< T > & operator=(const coordinates_ndr< T > &x_coordinates)
string display_cartesian_3d() const
void move(const scalar_unit &new_x)
string display_polar() const
void move(const displacement_3d &x_displacement)
angle get_spherical_theta() const
void point_to(direction::name x)
scalar_unit get_altitude() const
void rotate_in_3d(int axis, const angle &new_theta)
static coordinates_ndr< T > origin(const coordinates_ndr< T > &origin, const coordinates_ndr< T > &coordinates)
void set_angles(const vector< angle > &new_angles)
void set_position(const angle &new_latitude, const angle &new_longitude, const scalar_unit &new_altitude)
void change_nd(const vector< scalar_unit > &new_values, const vector< float > &new_angles)
T distance_to_origin() const
latitude get_latitude() const
angle get_spherical_phi() const
string display_spherical() const
coordinates_ndr(const scalar_unit &new_x, const scalar_unit &new_y, const scalar_unit &new_z, const angle &new_theta, const angle &new_phi)
coordinates_ndr(const angle &new_latitude, const angle &new_longitude, const scalar_unit &new_altitude, const angle &new_theta, const angle &new_phi)
void set_position(const scalar_unit &new_x, const scalar_unit &new_y, const scalar_unit &new_z)
coordinates_ndr(coordinates_nd< U > &&new_coordinates, const vector< angle > &new_angles)
void move(const displacement_2d &x_displacement)
void set_angles(const vector< float > &new_angles)
coordinates_ndr(const string &init_coordinates_ndr)
coordinates_ndr(const scalar_unit &new_x)
void rotate_in_2d(const angle &new_theta)
void move(const scalar_unit &new_x, const scalar_unit &new_y, const scalar_unit &new_z)
void move(const scalar_unit &new_r, const angle &new_theta, const angle &new_phi)
coordinates_ndr(const scalar_unit &new_r, const angle &new_spherical_theta, const angle &new_spherical_phi, const angle &new_theta, const angle &new_phi)
void move(const scalar_unit &new_x, const scalar_unit &new_y)
coordinates_ndr(const coordinates_ndr< T > &x)
void set_values(const vector< scalar_unit > &new_values)
void set_position(const vector< scalar_unit > &new_values)
void set_position(const scalar_unit &new_r, const angle &new_theta, const angle &new_phi)
string display_cartesian_2d() const
const vector< T > & get_values() const
longitude get_longitude() const
void move(const scalar_unit &new_p, const angle &new_theta)
void set_position(const scalar_unit &new_x, const scalar_unit &new_y)
const T & get_value(int i) const
Class that allows to create scalar units, which are composed of a value (as a float) and dimensions....
void operator+=(string &x, const scifir::coordinates_ndr< T > &y)
istream & operator>>(istream &is, scifir::coordinates_ndr< T > &x)
bool operator!=(const scifir::coordinates_ndr< T > &x, const scifir::coordinates_ndr< U > &y)
bool operator==(const scifir::coordinates_ndr< T > &x, const scifir::coordinates_ndr< U > &y)
ostream & operator<<(ostream &os, const scifir::coordinates_ndr< T > &x)
string operator+(const string &x, const scifir::coordinates_ndr< T > &y)
The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
bool is_latitude(const string &init_latitude)
scalar_unit ECEF_to_LLA_altitude(const scalar_unit &x, scalar_unit y, const scalar_unit &z)
float cos(const angle &x)
Calculates the cos of angle x. It uses the cos() function of the standard library of C++,...
scalar_unit pow(const scalar_unit &x, int exponent)
Exponentiates a scalar_unit to some numeric type, the dimensions are also exponentiated.
bool is_longitude(const string &init_longitude)
float atan_degree(float x)
Calculates the atan receiving x in degrees. It uses the atan() function of the standard library of C+...
longitude ECEF_to_LLA_longitude(const scalar_unit &x, scalar_unit y, const scalar_unit &z)
string to_string(const aid &x)
Creates a string representation of aid, it's for aid equivalent to the display() function of aid.
float distance(const coordinates_1d< float > &x, const coordinates_1d< float > &y)
string display_float(const float &value, int number_of_decimals)
float acos_degree(float x)
Calculates the acos receiving x in degrees. It uses the acos() function of the standard library of C+...
angle coordinates_ndr_no_angle
latitude ECEF_to_LLA_latitude(const scalar_unit &x, scalar_unit y, const scalar_unit &z)
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 is_angle(const string &init_angle)
Checks if some string is an initialization string of an angle.