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
coordinates_3d.cpp
Go to the documentation of this file.
2
3using namespace std;
4
5namespace scifir
6{
8 {
9 switch(x)
10 {
12 return "NORTH";
14 return "SOUTH";
16 return "EAST";
18 return "WEST";
19 }
20 return "";
21 }
22
24 {
25 return x.display_cartesian();
26 }
27
29 {
30 if (x == "NORTH")
31 {
33 }
34 else if (x == "SOUTH")
35 {
37 }
38 else if (x == "EAST")
39 {
41 }
42 else if (x == "WEST")
43 {
45 }
47 }
48
50 {
51 return float(std::sqrt(std::pow(x.x - y.x,2) + std::pow(x.y - y.y,2) + std::pow(x.z - y.z,2)));
52 }
53}
54
55ostream& operator <<(ostream& os,const scifir::coordinates_3d<float>& x)
56{
57 return os << scifir::to_string(x);
58}
string display_cartesian() const
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.
The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
Definition address.cpp:6
cardinale_point create_cardinale_point(const string &x)
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
float distance(const coordinates_1d< float > &x, const coordinates_1d< float > &y)