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
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Functions
coordinates_3d.hpp File Reference
#include "../meca_number/angle.hpp"
#include "../units/base_units.hpp"
#include "../derived_units/physics_units.hpp"
#include "../util/types.hpp"
#include "../units/constants.hpp"
#include "./latitude.hpp"
#include "./longitude.hpp"
#include <iostream>
#include <string>
#include <cmath>
Include dependency graph for coordinates_3d.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  scifir::coordinates_3d< T >
 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...
 
class  scifir::coordinates_3d< float >
 Specialization of coordinates_3d, with the same behaviour and functions, that is specialized for float types. It can be used when it's needed to save memory, because a float uses less memory than a scalar_unit. More...
 

Namespaces

namespace  scifir
 The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
 

Enumerations

enum class  scifir::cardinale_point { scifir::NORTH , scifir::SOUTH , scifir::EAST , scifir::WEST }
 

Functions

latitude scifir::ECEF_to_LLA_latitude (const scalar_unit &x, scalar_unit y, const scalar_unit &z)
 
longitude scifir::ECEF_to_LLA_longitude (const scalar_unit &x, scalar_unit y, const scalar_unit &z)
 
scalar_unit scifir::ECEF_to_LLA_altitude (const scalar_unit &x, scalar_unit y, const scalar_unit &z)
 
scalar_unit scifir::LLA_to_ECEF_x (const latitude &latitude, const longitude &longitude, scalar_unit altitude)
 
scalar_unit scifir::LLA_to_ECEF_y (const latitude &latitude, const longitude &longitude, scalar_unit altitude)
 
scalar_unit scifir::LLA_to_ECEF_z (const latitude &latitude, const longitude &longitude, scalar_unit altitude)
 
latitude scifir::ECEF_to_LLA_latitude (float x, float y, float z)
 
longitude scifir::ECEF_to_LLA_longitude (float x, float y, float z)
 
float scifir::ECEF_to_LLA_altitude (float x, float y, float z)
 
string scifir::to_string (cardinale_point x)
 
template<typename T >
string scifir::to_string (const coordinates_3d< T > &x)
 Returns the string representation of coordinates_3d.
 
string scifir::to_string (const coordinates_3d< float > &x)
 Returns the string representation of coordinates_3d<float>.
 
cardinale_point scifir::create_cardinale_point (const string &x)
 
template<typename T , typename U >
T scifir::distance (const coordinates_3d< T > &x, const coordinates_3d< U > &y)
 Calculates the distance between two coordinates_3d.
 
float scifir::distance (const coordinates_3d< float > &x, const coordinates_3d< float > &y)
 Calculates the distance between two coordinates_3d<float>.
 
scalar_unit scifir::cartesian_3d_to_cylindrical_p (const scalar_unit &x, scalar_unit y, const scalar_unit &z)
 Returns the p coordinate of the cylindrical coordinates given the x, y and z of cartesian coordinates in 3D.
 
angle scifir::cartesian_3d_to_cylindrical_theta (const scalar_unit &x, scalar_unit y, const scalar_unit &z)
 Returns the theta coordinate of the cylindrical coordinates given the x, y and z of cartesian coordinates in 3D.
 
scalar_unit scifir::cartesian_3d_to_cylindrical_z (const scalar_unit &x, const scalar_unit &y, const scalar_unit &z)
 Returns the z coordinate of the cylindrical coordinates given the x, y and z of cartesian coordinates in 3D.
 
scalar_unit scifir::cartesian_3d_to_spherical_r (const scalar_unit &x, scalar_unit y, scalar_unit z)
 Returns the r coordinate of the spherical coordinates given the x, y and z of cartesian coordinates in 3D.
 
angle scifir::cartesian_3d_to_spherical_theta (const scalar_unit &x, scalar_unit y, const scalar_unit &z)
 Returns the theta coordinate of the spherical coordinates given the x, y and z of cartesian coordinates in 3D.
 
angle scifir::cartesian_3d_to_spherical_phi (const scalar_unit &x, scalar_unit y, scalar_unit z)
 Returns the phi coordinate of the spherical coordinates given the x, y and z of cartesian coordinates in 3D.
 
scalar_unit scifir::spherical_to_cartesian_3d_x (const scalar_unit &r, const angle &theta, const angle &phi)
 Returns the x coordinate of the cartesian coordinates in 3D given the r, theta and phi of spherical coordinates.
 
scalar_unit scifir::spherical_to_cartesian_3d_y (const scalar_unit &r, const angle &theta, const angle &phi)
 Returns the y coordinate of the cartesian coordinates in 3D given the r, theta and phi of spherical coordinates.
 
scalar_unit scifir::spherical_to_cartesian_3d_z (const scalar_unit &r, const angle &theta, const angle &phi)
 Returns the z coordinate of the cartesian coordinates in 3D given the r, theta and phi of spherical coordinates.
 
scalar_unit scifir::spherical_to_cylindrical_p (const scalar_unit &r, const angle &theta, const angle &phi)
 Returns the p coordinate of the cylindrical coordinates given the r, theta and phi of spherical coordinates.
 
angle scifir::spherical_to_cylindrical_theta (const scalar_unit &r, const angle &theta, const angle &phi)
 Returns the theta coordinate of the cylindrical coordinates given the r, theta and phi of spherical coordinates.
 
scalar_unit scifir::spherical_to_cylindrical_z (const scalar_unit &r, const angle &theta, const angle &phi)
 Returns the z coordinate of the cylindrical coordinates given the r, theta and phi of spherical coordinates.
 
scalar_unit scifir::cylindrical_to_cartesian_3d_x (const scalar_unit &p, const angle &theta, const scalar_unit &z)
 Returns the x coordinate of the cartesian coordinates in 3D given the p, theta and z of cylindrical coordinates.
 
scalar_unit scifir::cylindrical_to_cartesian_3d_y (const scalar_unit &p, const angle &theta, const scalar_unit &z)
 Returns the y coordinate of the cartesian coordinates in 3D given the p, theta and z of cylindrical coordinates.
 
scalar_unit scifir::cylindrical_to_cartesian_3d_z (const scalar_unit &p, const angle &theta, const scalar_unit &z)
 Returns the z coordinate of the cartesian coordinates in 3D given the p, theta and z of cylindrical coordinates.
 
scalar_unit scifir::cylindrical_to_spherical_r (const scalar_unit &p, const angle &theta, scalar_unit z)
 Returns the r coordinate of the spherical coordinates given the p, theta and z of cylindrical coordinates.
 
angle scifir::cylindrical_to_spherical_theta (const scalar_unit &p, const angle &theta, const scalar_unit &z)
 Returns the theta coordinate of the spherical coordinates given the p, theta and z of cylindrical coordinates.
 
angle scifir::cylindrical_to_spherical_phi (const scalar_unit &p, const angle &theta, scalar_unit z)
 Returns the phi coordinate of the spherical coordinates given the p, theta and z of cylindrical coordinates.
 
float scifir::cartesian_3d_to_cylindrical_p (float x, float y, float z)
 Returns the p coordinate of the cylindrical coordinates given the x, y and z of cartesian coordinates in 3D.
 
angle scifir::cartesian_3d_to_cylindrical_theta (float x, float y, float z)
 Returns the theta coordinate of the cylindrical coordinates given the x, y and z of cartesian coordinates in 3D.
 
float scifir::cartesian_3d_to_cylindrical_z (float x, float y, float z)
 Returns the z coordinate of the cylindrical coordinates given the x, y and z of cartesian coordinates in 3D.
 
float scifir::cartesian_3d_to_spherical_r (float x, float y, float z)
 Returns the r coordinate of the spherical coordinates given the x, y and z of cartesian coordinates in 3D.
 
angle scifir::cartesian_3d_to_spherical_theta (float x, float y, float z)
 Returns the theta coordinate of the spherical coordinates given the x, y and z of cartesian coordinates in 3D.
 
angle scifir::cartesian_3d_to_spherical_phi (float x, float y, float z)
 Returns the phi coordinate of the spherical coordinates given the x, y and z of cartesian coordinates in 3D.
 
float scifir::spherical_to_cartesian_3d_x (float r, const angle &theta, const angle &phi)
 Returns the x coordinate of the cartesian coordinates in 3D given the r, theta and phi of spherical coordinates.
 
float scifir::spherical_to_cartesian_3d_y (float r, const angle &theta, const angle &phi)
 Returns the y coordinate of the cartesian coordinates in 3D given the r, theta and phi of spherical coordinates.
 
float scifir::spherical_to_cartesian_3d_z (float r, const angle &theta, const angle &phi)
 Returns the z coordinate of the cartesian coordinates in 3D given the r, theta and phi of spherical coordinates.
 
float scifir::spherical_to_cylindrical_p (float r, const angle &theta, const angle &phi)
 Returns the p coordinate of the cylindrical coordinates given the r, theta and phi of spherical coordinates.
 
angle scifir::spherical_to_cylindrical_theta (float r, const angle &theta, const angle &phi)
 Returns the theta coordinate of the cylindrical coordinates given the r, theta and phi of spherical coordinates.
 
float scifir::spherical_to_cylindrical_z (float r, const angle &theta, const angle &phi)
 Returns the z coordinate of the cylindrical coordinates given the r, theta and phi of spherical coordinates.
 
float scifir::cylindrical_to_cartesian_3d_x (float p, const angle &theta, float z)
 Returns the x coordinate of the cartesian coordinates in 3D given the p, theta and z of cylindrical coordinates.
 
float scifir::cylindrical_to_cartesian_3d_y (float p, const angle &theta, float z)
 Returns the y coordinate of the cartesian coordinates in 3D given the p, theta and z of cylindrical coordinates.
 
float scifir::cylindrical_to_cartesian_3d_z (float p, const angle &theta, float z)
 Returns the z coordinate of the cartesian coordinates in 3D given the p, theta and z of cylindrical coordinates.
 
float scifir::cylindrical_to_spherical_r (float p, const angle &theta, float z)
 Returns the r coordinate of the spherical coordinates given the p, theta and z of cylindrical coordinates.
 
angle scifir::cylindrical_to_spherical_theta (float p, const angle &theta, float z)
 Returns the theta coordinate of the spherical coordinates given the p, theta and z of cylindrical coordinates.
 
angle scifir::cylindrical_to_spherical_phi (float p, const angle &theta, float z)
 Returns the phi coordinate of the spherical coordinates given the p, theta and z of cylindrical coordinates.
 
template<typename T , typename U >
bool operator== (const scifir::coordinates_3d< T > &x, const scifir::coordinates_3d< U > &y)
 Returns true if both coordinates are equal in the three components.
 
template<typename T , typename U >
bool operator!= (const scifir::coordinates_3d< T > &x, const scifir::coordinates_3d< U > &y)
 Returns true if both coordinates are different.
 
template<typename T >
bool operator== (const scifir::coordinates_3d< T > &x, const string &init_coordinates_3d)
 Returns true if the coordinates and the initialization string of coordinates_3d represent the same coordinates.
 
template<typename T >
bool operator!= (const scifir::coordinates_3d< T > &x, const string &init_coordinates_3d)
 Returns true if the coordinates and the initialization string of coordinates_3d represent different coordinates.
 
template<typename T >
bool operator== (const string &init_coordinates_3d, const scifir::coordinates_3d< T > &x)
 Returns true if the coordinates and the initialization string of coordinates_3d represent the same coordinates.
 
template<typename T >
bool operator!= (const string &init_coordinates_3d, const scifir::coordinates_3d< T > &x)
 Returns true if the coordinates and the initialization string of coordinates_3d represent different coordinates.
 
template<typename T >
void operator+= (string &x, const scifir::coordinates_3d< T > &y)
 Concatenates to the string x the string representation of the coordinates_3d y.
 
template<typename T >
string operator+ (const string &x, const scifir::coordinates_3d< T > &y)
 Concatenates the string x and the string representation of the coordinates_3d y.
 
template<typename T >
string operator+ (const scifir::coordinates_3d< T > &x, const string &y)
 Concatenates the string y and the string representation of the coordinates_3d x.
 
template<typename T >
ostream & operator<< (ostream &os, const scifir::coordinates_3d< T > &x)
 Adds the string representation of the coordinates_3d x to an output stream os.
 
ostream & operator<< (ostream &os, const scifir::coordinates_3d< float > &x)
 Adds the string representation of the coordinates_3d<float> x to an output stream os.
 
template<typename T >
istream & operator>> (istream &is, scifir::coordinates_3d< T > &x)
 Allows that an istream initializes by string a coordinates_3d x.
 

Function Documentation

◆ operator!=() [1/3]

template<typename T , typename U >
bool operator!= ( const scifir::coordinates_3d< T > &  x,
const scifir::coordinates_3d< U > &  y 
)

Returns true if both coordinates are different.

Definition at line 930 of file coordinates_3d.hpp.

931{
932 return !(x == y);
933}

◆ operator!=() [2/3]

template<typename T >
bool operator!= ( const scifir::coordinates_3d< T > &  x,
const string &  init_coordinates_3d 
)

Returns true if the coordinates and the initialization string of coordinates_3d represent different coordinates.

Definition at line 943 of file coordinates_3d.hpp.

944{
945 return !(x == init_coordinates_3d);
946}

◆ operator!=() [3/3]

template<typename T >
bool operator!= ( const string &  init_coordinates_3d,
const scifir::coordinates_3d< T > &  x 
)

Returns true if the coordinates and the initialization string of coordinates_3d represent different coordinates.

Definition at line 956 of file coordinates_3d.hpp.

957{
958 return !(init_coordinates_3d == x);
959}

◆ operator+() [1/2]

template<typename T >
string operator+ ( const scifir::coordinates_3d< T > &  x,
const string &  y 
)

Concatenates the string y and the string representation of the coordinates_3d x.

Definition at line 974 of file coordinates_3d.hpp.

975{
976 return to_string(x) + y;
977}
string to_string(const aid &x)
Creates a string representation of aid, it's for aid equivalent to the display() function of aid.
Definition aid.cpp:582

◆ operator+() [2/2]

template<typename T >
string operator+ ( const string &  x,
const scifir::coordinates_3d< T > &  y 
)

Concatenates the string x and the string representation of the coordinates_3d y.

Definition at line 968 of file coordinates_3d.hpp.

969{
970 return x + to_string(y);
971}

◆ operator+=()

template<typename T >
void operator+= ( string &  x,
const scifir::coordinates_3d< T > &  y 
)

Concatenates to the string x the string representation of the coordinates_3d y.

Definition at line 962 of file coordinates_3d.hpp.

963{
964 x += to_string(y);
965}

◆ operator<<() [1/2]

ostream & operator<< ( ostream &  os,
const scifir::coordinates_3d< float > &  x 
)

Adds the string representation of the coordinates_3d<float> x to an output stream os.

Definition at line 55 of file coordinates_3d.cpp.

56{
57 return os << scifir::to_string(x);
58}

◆ operator<<() [2/2]

template<typename T >
ostream & operator<< ( ostream &  os,
const scifir::coordinates_3d< T > &  x 
)

Adds the string representation of the coordinates_3d x to an output stream os.

Definition at line 980 of file coordinates_3d.hpp.

981{
982 return os << to_string(x);
983}

◆ operator==() [1/3]

template<typename T , typename U >
bool operator== ( const scifir::coordinates_3d< T > &  x,
const scifir::coordinates_3d< U > &  y 
)

Returns true if both coordinates are equal in the three components.

Definition at line 917 of file coordinates_3d.hpp.

918{
919 if (x.x == y.x and x.y == y.y and x.z == y.z)
920 {
921 return true;
922 }
923 else
924 {
925 return false;
926 }
927}

◆ operator==() [2/3]

template<typename T >
bool operator== ( const scifir::coordinates_3d< T > &  x,
const string &  init_coordinates_3d 
)

Returns true if the coordinates and the initialization string of coordinates_3d represent the same coordinates.

Definition at line 936 of file coordinates_3d.hpp.

937{
938 scifir::coordinates_3d<T> y(init_coordinates_3d);
939 return (x == y);
940}

◆ operator==() [3/3]

template<typename T >
bool operator== ( const string &  init_coordinates_3d,
const scifir::coordinates_3d< T > &  x 
)

Returns true if the coordinates and the initialization string of coordinates_3d represent the same coordinates.

Definition at line 949 of file coordinates_3d.hpp.

950{
951 scifir::coordinates_3d<T> y(init_coordinates_3d);
952 return (x == y);
953}

◆ operator>>()

template<typename T >
istream & operator>> ( istream &  is,
scifir::coordinates_3d< T > &  x 
)

Allows that an istream initializes by string a coordinates_3d x.

Definition at line 988 of file coordinates_3d.hpp.

989{
990 char a[256];
991 is.getline(a, 256);
992 string b(a);
993 boost::trim(b);
995 return is;
996}