1#ifndef SCIFIR_UNITS_COORDINATES_COORDINATES_2DR_HPP_INCLUDED
2#define SCIFIR_UNITS_COORDINATES_COORDINATES_2DR_HPP_INCLUDED
5#include "../coordinates/direction.hpp"
6#include "../meca_number/angle.hpp"
7#include "../util/types.hpp"
16 template<
typename T = length>
185 out <<
"(" <<
x <<
"," <<
y <<
";" <<
theta <<
")";
308 return float(std::sqrt(std::pow(
x,2) + std::pow(
y,2)));
392 return float(std::sqrt(std::pow(
x,2) + std::pow(
y,2)));
461 string to_string(
const coordinates_2dr<float>& x);
463 template<
typename T,
typename U>
469 float distance(
const coordinates_2dr<float>& x,
const coordinates_2dr<float>& y);
471 template<
typename T,
typename U>
477 float distance(
const coordinates_2dr<float>& x,
const coordinates_2d<float>& y);
479 template<
typename T,
typename U>
485 float distance(
const coordinates_2d<float>& x,
const coordinates_2dr<float>& y);
488template<
typename T,
typename U>
491 if (x.
x == y.
x and x.y == y.y and x.theta == y.theta)
501template<
typename T,
typename U>
507template<
typename T,
typename U>
510 if (x.
x == y.
x and x.y == y.y)
520template<
typename T,
typename U>
526template<
typename T,
typename U>
529 if (x.
x == y.
x and x.y == y.y)
539template<
typename T,
typename U>
555 return !(x == init_coordinates_2dr);
568 return !(init_coordinates_2dr == x);
580 return x + to_string(y);
586 return to_string(x) + y;
592 return os << to_string(x);
Class that allows to work with angles. Each angle sizes 4 bytes. Initialization string example: "20°"...
string display_cartesian() const
void move(const scalar_unit &x_value)
coordinates_2dr(float new_p, const angle &new_polar_theta, const angle &new_theta)
void set_position(float new_p, const angle &new_theta)
void set_position(float new_x, float new_y)
void move(const displacement_2d &x_displacement)
coordinates_2dr(const scifir::coordinates_2d< float > &new_point, const angle &new_theta)
void initialize_from_string(string init_coordinates_2dr)
string display_polar() const
coordinates_2dr(scifir::coordinates_2d< float > &&new_point, const angle &new_theta)
coordinates_2dr(float new_x, float new_y, const angle &new_theta)
void move(float new_x, float new_y)
float distance_to_origin() const
angle get_polar_theta() const
void rotate(const angle &x_angle)
coordinates_2dr(coordinates_2dr< float > &&x_coordinates)
coordinates_2dr(const string &init_coordinates_2dr)
void move(float new_p, const angle &new_theta)
void point_to(direction::name x)
coordinates_2dr(const coordinates_2dr< float > &x_coordinates)
string display_cartesian() const
angle get_polar_theta() const
coordinates_2dr(const scalar_unit &new_x, const scalar_unit &new_y, const angle &new_theta)
void move(const scalar_unit &new_x, const scalar_unit &new_y)
coordinates_2dr(const string &init_coordinates_2dr)
coordinates_2dr(scifir::coordinates_2d< U > &&new_coordinates, const angle &new_theta)
void initialize_from_string(string init_coordinates_2dr)
coordinates_2dr(const coordinates_2dr< T > &x_coordinates)
void point_to(direction::name x)
coordinates_2dr(const scifir::coordinates_2d< U > &new_coordinates, const angle &new_theta)
void move(const scalar_unit &new_p, const angle &new_theta)
void move(const displacement_2d &x_displacement)
string display_cartesian() const
coordinates_2dr< T > & operator=(const coordinates_2dr< T > &x_coordinates)
T distance_to_origin() const
string display_polar() const
void set_position(const scalar_unit &new_p, const angle &new_theta)
coordinates_2dr(coordinates_2dr< T > &&x_coordinates)
coordinates_2dr(const scalar_unit &new_p, const angle &new_polar_theta, const angle &new_theta)
void set_position(const scalar_unit &new_x, const scalar_unit &new_y)
void rotate(const angle &x_angle)
static coordinates_2dr< T > origin(const coordinates_2dr< T > &origin, const coordinates_2dr< T > &coordinates)
Class that allows to create scalar units, which are composed of a value (as a float) and dimensions....
ostream & operator<<(ostream &os, const scifir::coordinates_2dr< T > &x)
void operator+=(string &x, const scifir::coordinates_2dr< T > &y)
istream & operator>>(istream &is, scifir::coordinates_2dr< T > &x)
bool operator!=(const scifir::coordinates_2dr< T > &x, const scifir::coordinates_2dr< U > &y)
string operator+(const string &x, const scifir::coordinates_2dr< T > &y)
bool operator==(const scifir::coordinates_2dr< T > &x, const scifir::coordinates_2dr< U > &y)
The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
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.
string to_string(const aid &x)
Creates a string representation of aid, it's for aid equivalent to the display() function of aid.
angle atan2(float y, float x)
float distance(const coordinates_1d< float > &x, const coordinates_1d< float > &y)
string display_float(const float &value, int number_of_decimals)
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.