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 represents the position in 3D spaces. The space can be a length or, for the case of imaginary spaces, any custom dimension. The most interesting feature is the fact that all the coordinates systems in 3D are present at the same time, it's possible to use cartesian, cylindrical or spherical coordinates as needed for the same instance of coordinates, it's not needed to select just one of those systems. The geographical coordinates aren't yet finished. More...
#include <coordinates_3d.hpp>
Public Types | |
enum | type { CARTESIAN , CYLINDRICAL , SPHERICAL , GEODESIC } |
Public Member Functions | |
coordinates_3d () | |
Default constructor. Initializes x, y and z to 0, with the default dimensions. | |
coordinates_3d (const coordinates_3d< T > &x_coordinates) | |
Copy constructor. Initializes x, y and z to the x, y and z of x_coordinates. | |
coordinates_3d (coordinates_3d< T > &&x_coordinates) | |
Move constructor. Initializes x, y and z to the x, y and z of x_coordinates. | |
coordinates_3d (const scalar_unit &new_x, const scalar_unit &new_y, const scalar_unit &new_z) | |
coordinates_3d (const scalar_unit &new_p, const angle &new_theta, scalar_unit new_z) | |
coordinates_3d (const scalar_unit &new_r, const angle &new_theta, const angle &new_phi) | |
coordinates_3d (const angle &new_latitude, const angle &new_longitude, const scalar_unit &new_altitude) | |
coordinates_3d (coordinates_3d::type coordinates_type, const string &coord1, const string &coord2, const string &coord3) | |
coordinates_3d (const string &init_coordinates_3d) | |
Constructor. Initializes x, y and z with the initialization string of coordinates_3d init_coordinates_3d. | |
coordinates_3d< T > & | operator= (const coordinates_3d< T > &x_coordinates) |
Copy assignment. Assigns x, y and z to the same values as the x, y and z of x_coordinates. | |
coordinates_3d< T > & | operator= (coordinates_3d< T > &&x_coordinates) |
Move assignment. Assigns x, y and z moved from the x, y and z of x_coordinates. | |
coordinates_3d< T > & | operator= (const string &init_coordinates_3d) |
Assignment. Assigns x, y and z to the values specified in the initialization string of coordinates_3d init_coordinates_3d. | |
T | get_p () const |
Returns the value of p in cylindrical coordinates. | |
angle | get_theta () const |
Returns the value of theta in cylindrical and spherical coordinates (it's the same theta). | |
T | get_r () const |
Returns the value of r in spherical coordinates. | |
angle | get_phi () const |
Returns the value of phi in spherical coordinates. | |
latitude | get_latitude () const |
Returns the latitude in LLA geographical coordinates. In this case, coordinates_3d represents all the Earth inside an ellipsoid as in the standard WGS84. | |
longitude | get_longitude () const |
Returns the longitude in LLA geographical coordinates. In this case, coordinates_3d represents all the Earth inside an ellipsoid as in the standard WGS84. | |
scalar_unit | get_altitude () const |
Returns the altitude in LLA geographical coordinates. In this case, coordinates_3d represents all the Earth inside an ellipsoid as in the standard WGS84. | |
void | set_position (const scalar_unit &new_x, const scalar_unit &new_y, const scalar_unit &new_z) |
void | set_position (const scalar_unit &new_p, const angle &new_theta, scalar_unit new_z) |
void | set_position (const scalar_unit &new_r, const angle &new_theta, const angle &new_phi) |
void | set_position (const latitude &new_latitude, const longitude &new_longitude, const scalar_unit &new_altitude) |
void | rotate_in_x (const angle &x_angle) |
Rotates around the edge x the amount of the param x_angle. | |
void | rotate_in_y (const angle &x_angle) |
Rotates around the edge y the amount of the param x_angle. | |
void | rotate_in_z (const angle &x_angle) |
Rotates around the edge z the amount of the param x_angle. | |
void | move (const displacement_3d &x_displacement) |
Moves x, y and z in the vector x_displacement given. | |
void | move (const scalar_unit &new_x, const scalar_unit &new_y, const scalar_unit &new_z) |
void | move (const scalar_unit &new_p, const angle &new_theta, scalar_unit new_z) |
void | move (const scalar_unit &new_r, const angle &new_theta, const angle &new_phi) |
T | distance_to_origin () const |
Calculates the distance to the origin. | |
string | display_cartesian () const |
Displays the coordinates in cartesian coordinates. | |
string | display_cylindrical () const |
Displays the coordinates in cylindrical coordinates. | |
string | display_spherical () const |
Displays the coordinates in spherical coordinates. | |
string | display_geographical () const |
Displays the coordinates in geographical coordinates. | |
Static Public Member Functions | |
static coordinates_3d< T > | origin (const coordinates_3d< T > &origin, const coordinates_3d< T > &coordinates) |
Public Attributes | |
T | x |
The position in the edge x. The space can have dimensions of length or of any custom dimension. | |
T | y |
The position in the edge y. The space can have dimensions of length or of any custom dimension. | |
T | z |
The position in the edge z. The space can have dimensions of length or of any custom dimension. | |
Protected Member Functions | |
void | initialize_from_string (string init_coordinates_3d) |
Internal function. Initializes x, y and z with the initialization string of coordinates_3d init_coordinates_3d. | |
Class that represents the position in 3D spaces. The space can be a length or, for the case of imaginary spaces, any custom dimension. The most interesting feature is the fact that all the coordinates systems in 3D are present at the same time, it's possible to use cartesian, cylindrical or spherical coordinates as needed for the same instance of coordinates, it's not needed to select just one of those systems. The geographical coordinates aren't yet finished.
Definition at line 129 of file coordinates_3d.hpp.
Enumerator | |
---|---|
CARTESIAN | |
CYLINDRICAL | |
SPHERICAL | |
GEODESIC |
Definition at line 132 of file coordinates_3d.hpp.
Default constructor. Initializes x, y and z to 0, with the default dimensions.
Definition at line 134 of file coordinates_3d.hpp.
|
inline |
Copy constructor. Initializes x, y and z to the x, y and z of x_coordinates.
Definition at line 137 of file coordinates_3d.hpp.
|
inline |
Move constructor. Initializes x, y and z to the x, y and z of x_coordinates.
Definition at line 140 of file coordinates_3d.hpp.
|
inlineexplicit |
Definition at line 143 of file coordinates_3d.hpp.
|
inlineexplicit |
Definition at line 146 of file coordinates_3d.hpp.
|
inlineexplicit |
Definition at line 151 of file coordinates_3d.hpp.
|
inlineexplicit |
Definition at line 156 of file coordinates_3d.hpp.
|
inlineexplicit |
Definition at line 161 of file coordinates_3d.hpp.
Constructor. Initializes x, y and z with the initialization string of coordinates_3d init_coordinates_3d.
Definition at line 181 of file coordinates_3d.hpp.
Displays the coordinates in cartesian coordinates.
Definition at line 337 of file coordinates_3d.hpp.
Displays the coordinates in cylindrical coordinates.
Definition at line 344 of file coordinates_3d.hpp.
Displays the coordinates in geographical coordinates.
Definition at line 358 of file coordinates_3d.hpp.
Displays the coordinates in spherical coordinates.
Definition at line 351 of file coordinates_3d.hpp.
Calculates the distance to the origin.
Definition at line 332 of file coordinates_3d.hpp.
|
inline |
Returns the altitude in LLA geographical coordinates. In this case, coordinates_3d represents all the Earth inside an ellipsoid as in the standard WGS84.
Definition at line 245 of file coordinates_3d.hpp.
Returns the latitude in LLA geographical coordinates. In this case, coordinates_3d represents all the Earth inside an ellipsoid as in the standard WGS84.
Definition at line 235 of file coordinates_3d.hpp.
Returns the longitude in LLA geographical coordinates. In this case, coordinates_3d represents all the Earth inside an ellipsoid as in the standard WGS84.
Definition at line 240 of file coordinates_3d.hpp.
Returns the value of p in cylindrical coordinates.
Definition at line 215 of file coordinates_3d.hpp.
Returns the value of phi in spherical coordinates.
Definition at line 230 of file coordinates_3d.hpp.
Returns the value of r in spherical coordinates.
Definition at line 225 of file coordinates_3d.hpp.
Returns the value of theta in cylindrical and spherical coordinates (it's the same theta).
Definition at line 220 of file coordinates_3d.hpp.
Internal function. Initializes x, y and z with the initialization string of coordinates_3d init_coordinates_3d.
Definition at line 370 of file coordinates_3d.hpp.
|
inline |
Moves x, y and z in the vector x_displacement given.
Definition at line 303 of file coordinates_3d.hpp.
|
inline |
Definition at line 317 of file coordinates_3d.hpp.
|
inline |
Definition at line 325 of file coordinates_3d.hpp.
|
inline |
Definition at line 310 of file coordinates_3d.hpp.
|
inline |
Copy assignment. Assigns x, y and z to the same values as the x, y and z of x_coordinates.
Definition at line 186 of file coordinates_3d.hpp.
|
inline |
Assignment. Assigns x, y and z to the values specified in the initialization string of coordinates_3d init_coordinates_3d.
Definition at line 202 of file coordinates_3d.hpp.
|
inline |
Move assignment. Assigns x, y and z moved from the x, y and z of x_coordinates.
Definition at line 194 of file coordinates_3d.hpp.
|
inlinestatic |
Definition at line 208 of file coordinates_3d.hpp.
Rotates around the edge x the amount of the param x_angle.
Definition at line 279 of file coordinates_3d.hpp.
Rotates around the edge y the amount of the param x_angle.
Definition at line 287 of file coordinates_3d.hpp.
Rotates around the edge z the amount of the param x_angle.
Definition at line 295 of file coordinates_3d.hpp.
|
inline |
Definition at line 272 of file coordinates_3d.hpp.
|
inline |
Definition at line 257 of file coordinates_3d.hpp.
|
inline |
Definition at line 265 of file coordinates_3d.hpp.
|
inline |
Definition at line 250 of file coordinates_3d.hpp.
The position in the edge x. The space can have dimensions of length or of any custom dimension.
Definition at line 365 of file coordinates_3d.hpp.
The position in the edge y. The space can have dimensions of length or of any custom dimension.
Definition at line 366 of file coordinates_3d.hpp.
The position in the edge z. The space can have dimensions of length or of any custom dimension.
Definition at line 367 of file coordinates_3d.hpp.