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_nd.hpp
Go to the documentation of this file.
1#ifndef SCIFIR_UNITS_COORDINATES_COORDINATES_ND_HPP_INCLUDED
2#define SCIFIR_UNITS_COORDINATES_COORDINATES_ND_HPP_INCLUDED
3
4#include "../derived_units/physics_units.hpp"
5#include "../units/base_units.hpp"
6#include "../util/types.hpp"
9
10#include <iostream>
11#include <string>
12#include <vector>
13
14using namespace std;
15
16namespace scifir
17{
18 template<typename T = length>
20 {
21 public:
24
27
30
31 template<typename U>
33 {
34 for(const U& x_value : new_values)
35 {
36 values.push_back(T(x_value));
37 }
38 }
39
41 {
42 values.push_back(T(new_x));
43 }
44
46 {
47 values.push_back(T(new_x));
48 values.push_back(T(new_y));
49 }
50
52 {
54 }
55
57 {
58 values.push_back(T(new_x));
59 values.push_back(T(new_y));
60 values.push_back(T(new_z));
61 }
62
67
72
77
89
109
114
116 {
117 values = x_coordinates.values;
118 return *this;
119 }
120
122 {
123 values = std::move(x_coordinates.values);
124 return *this;
125 }
126
132
134 {
136 for (unsigned int i = 0; i < coordinates.values.size(); i++)
137 {
138 new_coordinates.values[i] += coordinates.values[i];
139 }
140 return new_coordinates;
141 }
142
143 bool is_nd(int i) const
144 {
145 return values.size() == i;
146 }
147
148 int get_nd() const
149 {
150 return values.size();
151 }
152
153 T get_p() const
154 {
155 if (get_nd() == 2 or get_nd() == 3)
156 {
157 return T(scifir::sqrt(scifir::pow(values[0],2) + scifir::pow(values[1],2)));
158 }
159 else
160 {
161 return T();
162 }
163 }
164
166 {
167 if (get_nd() == 2 or get_nd() == 3)
168 {
169 return angle(scifir::atan_degree(float(values[1]/values[0])));
170 }
171 else
172 {
173 return angle();
174 }
175 }
176
177 T get_r() const
178 {
179 if (get_nd() == 2 or get_nd() == 3)
180 {
181 return T(scifir::sqrt(scifir::pow(values[0],2) + scifir::pow(values[1],2) + scifir::pow(values[2],2)));
182 }
183 else
184 {
185 return T();
186 }
187 }
188
190 {
191 if (get_nd() == 3)
192 {
194 }
195 else
196 {
197 return angle();
198 }
199 }
200
202 {
203 if (get_nd() == 3)
204 {
205 return ECEF_to_LLA_latitude(values[0],values[1],values[2]);
206 }
207 else
208 {
209 return latitude();
210 }
211 }
212
214 {
215 if (get_nd() == 3)
216 {
217 return ECEF_to_LLA_longitude(values[0],values[1],values[2]);
218 }
219 else
220 {
221 return longitude();
222 }
223 }
224
226 {
227 if (get_nd() == 3)
228 {
229 return ECEF_to_LLA_altitude(values[0],values[1],values[2]);
230 }
231 else
232 {
233 return scalar_unit();
234 }
235 }
236
238 {
239 values.clear();
240 values.push_back(T(new_x));
241 }
242
244 {
245 values.clear();
246 values.push_back(T(new_x));
247 values.push_back(T(new_y));
248 }
249
251 {
252 values.clear();
253 values.push_back(T(new_p * scifir::cos(new_theta)));
254 values.push_back(T(new_p * scifir::sin(new_theta)));
255 }
256
258 {
259 values.clear();
260 values.push_back(T(new_x));
261 values.push_back(T(new_y));
262 values.push_back(T(new_z));
263 }
264
266 {
267 values.clear();
268 new_z.change_dimensions(new_p);
269 values.push_back(T(new_p * scifir::cos(new_theta)));
270 values.push_back(T(new_p * scifir::sin(new_theta)));
271 values.push_back(T(new_z));
272 }
273
275 {
276 values.clear();
279 values.push_back(T(new_r * scifir::cos(new_phi)));
280 }
281
289
291 {
292 values.clear();
294 }
295
297 {
298 if (get_nd() == 2)
299 {
300 T x_coord = values[0];
301 T y_coord = values[1];
304 }
305 }
306
308 {
309 if (get_nd() == 3)
310 {
311 if (axis == 1)
312 {
313 T y_coord = values[1];
314 T z_coord = values[2];
317 }
318 else if (axis == 2)
319 {
320 T x_coord = values[0];
321 T z_coord = values[2];
324 }
325 else if (axis == 3)
326 {
327 T x_coord = values[0];
328 T y_coord = values[1];
331 }
332 }
333 }
334
335 void move(const scalar_unit& new_x)
336 {
337 if (values.size() == 1)
338 {
339 values[0] += new_x;
340 }
341 }
342
344 {
345 if (values.size() == 2)
346 {
347 values[0] += x_displacement.x_projection();
348 values[1] += x_displacement.y_projection();
349 }
350 }
351
353 {
354 if (values.size() == 2)
355 {
356 values[0] += new_x;
357 values[1] += new_y;
358 }
359 }
360
362 {
363 if (values.size() == 2)
364 {
367 }
368 }
369
371 {
372 if (values.size() == 3)
373 {
374 values[0] += x_displacement.x_projection();
375 values[1] += x_displacement.y_projection();
376 values[2] += x_displacement.z_projection();
377 }
378 }
379
381 {
382 if (values.size() == 3)
383 {
384 values[0] += new_x;
385 values[1] += new_y;
386 values[2] += new_z;
387 }
388 }
389
391 {
392 if (values.size() == 3)
393 {
394 new_z.change_dimensions(new_p);
397 values[2] += new_z;
398 }
399 }
400
401 void move(const scalar_unit& new_r,const angle& new_theta,const angle& new_phi)
402 {
403 if (values.size() == 3)
404 {
407 values[2] += T(new_r * scifir::cos(new_phi));
408 }
409 }
410
412 {
413 if (x_displacement.get_nd() == get_nd())
414 {
415 for (int i = 0; i < x_displacement.get_nd(); i++)
416 {
417 values[i] += x_displacement.n_projection(i);
418 }
419 }
420 }
421
427
429 {
430 scalar_unit x_T = scalar_unit(0.0f,"m2");
431 for (int i = 0; i < values.size(); i++)
432 {
433 x_T += scifir::pow(values[i],2);
434 }
435 return T(scifir::sqrt(x_T));
436 }
437
438 string display_cartesian_2d() const
439 {
440 if (values.size() == 2)
441 {
443 out << "(" << values[0] << "," << values[1] << ")";
444 return out.str();
445 }
446 else
447 {
448 return "[no-2d]";
449 }
450 }
451
452 string display_polar() const
453 {
454 if (values.size() == 2)
455 {
457 out << "(" << get_p() << "," << get_theta() << ")";
458 return out.str();
459 }
460 else
461 {
462 return "[no-2d]";
463 }
464 }
465
466 string display_cartesian_3d() const
467 {
468 if (values.size() == 3)
469 {
471 out << "(" << values[0] << "," << values[1] << "," << values[2] << ")";
472 return out.str();
473 }
474 else
475 {
476 return "[no-3d]";
477 }
478 }
479
480 string display_cylindrical() const
481 {
482 if (values.size() == 3)
483 {
485 out << "(" << get_p() << "," << get_theta() << "," << values[2] << ")";
486 return out.str();
487 }
488 else
489 {
490 return "[no-3d]";
491 }
492 }
493
494 string display_spherical() const
495 {
496 if (values.size() == 3)
497 {
499 out << "(" << get_r() << "," << get_theta() << "," << get_phi() << ")";
500 return out.str();
501 }
502 else
503 {
504 return "[no-3d]";
505 }
506 }
507
508 string display_geographical() const
509 {
510 if (values.size() == 3)
511 {
513 out << "(" << get_latitude() << "," << get_longitude() << "," << get_altitude() << ")";
514 return out.str();
515 }
516 else
517 {
518 return "[no-3d]";
519 }
520 }
521
523
524 private:
526 {
528 if (init_coordinates_nd.front() == '(')
529 {
530 init_coordinates_nd.erase(0,1);
531 }
532 if (init_coordinates_nd.back() == ')')
533 {
535 }
536 boost::split(init_values,init_coordinates_nd,boost::is_any_of(","));
537 for (const string& x_value : init_values)
538 {
539 if (x_value == "")
540 {
541 return;
542 }
543 }
544 if (init_values.size() == 2)
545 {
546 if (is_angle(init_values[1]))
547 {
549 }
550 else
551 {
553 }
554 }
555 else if (init_values.size() == 3)
556 {
557 if (is_latitude(init_values[0]))
558 {
560 {
561 if (!is_angle(init_values[2]))
562 {
564 }
565 }
566 }
567 else
568 {
569 if (is_angle(init_values[1]))
570 {
571 if (is_angle(init_values[2]))
572 {
574 }
575 else
576 {
578 }
579 }
580 else
581 {
582 if (!is_angle(init_values[2]))
583 {
585 }
586 }
587 }
588 }
589 else
590 {
591 for (const string& x_value : init_values)
592 {
593 if (x_value != "")
594 {
595 values.push_back(T(x_value));
596 }
597 }
598 }
599 }
600 };
601
602 template<>
604 {
605 public:
607 {}
608
611
614
617
618 explicit coordinates_nd(float new_x) : values()
619 {
620 values.push_back(new_x);
621 }
622
623 explicit coordinates_nd(float new_x,float new_y) : values()
624 {
625 values.push_back(new_x);
626 values.push_back(new_y);
627 }
628
629 explicit coordinates_nd(float new_p,const angle& new_theta) : values()
630 {
632 }
633
634 explicit coordinates_nd(float new_x,float new_y,float new_z) : values()
635 {
636 values.push_back(new_x);
637 values.push_back(new_y);
638 values.push_back(new_z);
639 }
640
641 explicit coordinates_nd(float new_p,const angle& new_theta,float new_z) : values()
642 {
644 }
645
646 explicit coordinates_nd(float new_r,const angle& new_theta,const angle& new_phi) : values()
647 {
649 }
650
655
660
662 {
663 values = x_coordinates.values;
664 return *this;
665 }
666
668 {
669 values = std::move(x_coordinates.values);
670 return *this;
671 }
672
678
679 bool is_nd(unsigned int i) const
680 {
681 return values.size() == i;
682 }
683
684 int get_nd() const
685 {
686 return int(values.size());
687 }
688
689 float get_p() const
690 {
691 if (get_nd() == 2 or get_nd() == 3)
692 {
693 return float(std::sqrt(std::pow(values[0],2) + std::pow(values[1],2)));
694 }
695 else
696 {
697 return 0.0f;
698 }
699 }
700
702 {
703 if (get_nd() == 2 or get_nd() == 3)
704 {
705 return angle(scifir::atan_degree(float(values[1]/values[0])));
706 }
707 else
708 {
709 return angle();
710 }
711 }
712
713 float get_r() const
714 {
715 if (get_nd() == 2 or get_nd() == 3)
716 {
717 return float(std::sqrt(std::pow(values[0],2) + std::pow(values[1],2) + std::pow(values[2],2)));
718 }
719 else
720 {
721 return 0.0f;
722 }
723 }
724
726 {
727 if (get_nd() == 3)
728 {
729 return angle(scifir::acos_degree(float(values[2]/std::sqrt(std::pow(values[0],2) + std::pow(values[1],2) + std::pow(values[2],2)))));
730 }
731 else
732 {
733 return angle();
734 }
735 }
736
738 {
739 if (get_nd() == 3)
740 {
741 return ECEF_to_LLA_latitude(values[0],values[1],values[2]);
742 }
743 else
744 {
745 return latitude();
746 }
747 }
748
750 {
751 if (get_nd() == 3)
752 {
753 return ECEF_to_LLA_longitude(values[0],values[1],values[2]);
754 }
755 else
756 {
757 return longitude();
758 }
759 }
760
761 float get_altitude() const
762 {
763 if (get_nd() == 3)
764 {
765 return ECEF_to_LLA_altitude(values[0],values[1],values[2]);
766 }
767 else
768 {
769 return 0.0f;
770 }
771 }
772
773 void set_position(float new_x)
774 {
775 values.clear();
776 values.push_back(new_x);
777 }
778
779 void set_position(float new_x,float new_y)
780 {
781 values.clear();
782 values.push_back(new_x);
783 values.push_back(new_y);
784 }
785
787 {
788 values.clear();
789 values.push_back(new_p * scifir::cos(new_theta));
790 values.push_back(new_p * scifir::sin(new_theta));
791 }
792
793 void set_position(float new_x,float new_y,float new_z)
794 {
795 values.clear();
796 values.push_back(new_x);
797 values.push_back(new_y);
798 values.push_back(new_z);
799 }
800
801 void set_position(float new_p,const angle& new_theta,float new_z)
802 {
803 values.clear();
804 values.push_back(new_p * scifir::cos(new_theta));
805 values.push_back(new_p * scifir::sin(new_theta));
806 values.push_back(new_z);
807 }
808
809 void set_position(float new_r,const angle& new_theta,const angle& new_phi)
810 {
811 values.clear();
814 values.push_back(new_r * scifir::cos(new_phi));
815 }
816
824
826 {
827 values.clear();
829 }
830
832 {
833 if (get_nd() == 2)
834 {
835 float x_coord = values[0];
836 float y_coord = values[1];
839 }
840 }
841
843 {
844 if (get_nd() == 3)
845 {
846 if (axis == 1)
847 {
848 float y_coord = values[1];
849 float z_coord = values[2];
852 }
853 else if (axis == 2)
854 {
855 float x_coord = values[0];
856 float z_coord = values[2];
859 }
860 else if (axis == 3)
861 {
862 float x_coord = values[0];
863 float y_coord = values[1];
866 }
867 }
868 }
869
870 void move(float new_x)
871 {
872 if (values.size() == 1)
873 {
874 values[0] += new_x;
875 }
876 }
877
879 {
880 if (values.size() == 2)
881 {
882 values[0] += float(x_displacement.x_projection());
883 values[1] += float(x_displacement.y_projection());
884 }
885 }
886
887 void move(float new_x,float new_y)
888 {
889 if (values.size() == 2)
890 {
891 values[0] += new_x;
892 values[1] += new_y;
893 }
894 }
895
896 void move(float new_p,const angle& new_theta)
897 {
898 if (values.size() == 2)
899 {
902 }
903 }
904
906 {
907 if (values.size() == 3)
908 {
909 values[0] += float(x_displacement.x_projection());
910 values[1] += float(x_displacement.y_projection());
911 values[2] += float(x_displacement.z_projection());
912 }
913 }
914
915 void move(float new_x,float new_y,float new_z)
916 {
917 if (values.size() == 3)
918 {
919 values[0] += new_x;
920 values[1] += new_y;
921 values[2] += new_z;
922 }
923 }
924
925 void move(float new_p,const angle& new_theta,float new_z)
926 {
927 if (values.size() == 3)
928 {
931 values[2] += new_z;
932 }
933 }
934
935 void move(float new_r,const angle& new_theta,const angle& new_phi)
936 {
937 if (values.size() == 3)
938 {
942 }
943 }
944
946 {
947 if (x_displacement.get_nd() == get_nd())
948 {
949 for (int i = 0; i < x_displacement.get_nd(); i++)
950 {
951 values[i] += float(x_displacement.n_projection(i));
952 }
953 }
954 }
955
961
962 float distance_to_origin() const
963 {
964 float x_T = 0;
965 for (unsigned int i = 0; i < values.size(); i++)
966 {
967 x_T += float(std::pow(values[i],2));
968 }
969 return std::sqrt(x_T);
970 }
971
972 string display_cartesian_2d() const
973 {
974 if (values.size() == 2)
975 {
977 out << "(" << display_float(values[0]) << "," << display_float(values[1]) << ")";
978 return out.str();
979 }
980 else
981 {
982 return "[no-2d]";
983 }
984 }
985
986 string display_polar() const
987 {
988 if (values.size() == 2)
989 {
991 out << "(" << display_float(get_p()) << "," << get_theta() << ")";
992 return out.str();
993 }
994 else
995 {
996 return "[no-2d]";
997 }
998 }
999
1001 {
1002 if (values.size() == 3)
1003 {
1005 out << "(" << display_float(values[0]) << "," << display_float(values[1]) << "," << display_float(values[2]) << ")";
1006 return out.str();
1007 }
1008 else
1009 {
1010 return "[no-3d]";
1011 }
1012 }
1013
1014 string display_cylindrical() const
1015 {
1016 if (values.size() == 3)
1017 {
1019 out << "(" << display_float(get_p()) << "," << get_theta() << "," << display_float(values[2]) << ")";
1020 return out.str();
1021 }
1022 else
1023 {
1024 return "[no-3d]";
1025 }
1026 }
1027
1028 string display_spherical() const
1029 {
1030 if (values.size() == 3)
1031 {
1033 out << "(" << display_float(get_r()) << "," << get_theta() << "," << get_phi() << ")";
1034 return out.str();
1035 }
1036 else
1037 {
1038 return "[no-3d]";
1039 }
1040 }
1041
1043 {
1044 if (values.size() == 3)
1045 {
1047 out << "(" << get_latitude() << "," << get_longitude() << "," << display_float(get_altitude()) << ")";
1048 return out.str();
1049 }
1050 else
1051 {
1052 return "[no-3d]";
1053 }
1054 }
1055
1057
1058 private:
1060 {
1062 if (init_coordinates_nd.front() == '(')
1063 {
1064 init_coordinates_nd.erase(0,1);
1065 }
1066 if (init_coordinates_nd.back() == ')')
1067 {
1068 init_coordinates_nd.erase(init_coordinates_nd.size()-1,1);
1069 }
1070 boost::split(init_values,init_coordinates_nd,boost::is_any_of(","));
1071 for (const string& x_value : init_values)
1072 {
1073 if (x_value == "")
1074 {
1075 return;
1076 }
1077 }
1078 if (init_values.size() == 2)
1079 {
1080 if (is_angle(init_values[1]))
1081 {
1083 }
1084 else
1085 {
1087 }
1088 }
1089 else if (init_values.size() == 3)
1090 {
1091 if (is_latitude(init_values[0]))
1092 {
1093 if (is_longitude(init_values[1]))
1094 {
1095 if (!is_angle(init_values[2]))
1096 {
1098 }
1099 }
1100 }
1101 else
1102 {
1103 if (is_angle(init_values[1]))
1104 {
1105 if (is_angle(init_values[2]))
1106 {
1108 }
1109 else
1110 {
1112 }
1113 }
1114 else
1115 {
1116 if (!is_angle(init_values[2]))
1117 {
1119 }
1120 }
1121 }
1122 }
1123 else
1124 {
1125 for (const string& x_value : init_values)
1126 {
1127 values.push_back(stof(x_value));
1128 }
1129 }
1130 }
1131 };
1132
1133 template<typename T>
1135 {
1136 if (x.values.size() > 0)
1137 {
1139 out << "(";
1140 for (int i = 0; i < x.values.size(); i++)
1141 {
1142 out << x.values[i];
1143 if ((i + 1) != x.values.size())
1144 {
1145 out << ",";
1146 }
1147 }
1148 out << ")";
1149 return out.str();
1150 }
1151 else
1152 {
1153 return "[empty]";
1154 }
1155 }
1156
1157 string to_string(const coordinates_nd<float>& x);
1158
1159 template<typename T,typename U>
1161 {
1162 if (x.get_nd() == y.get_nd())
1163 {
1164 scalar_unit x_length = scalar_unit(0.0f,"m2");
1165 for (int i = 0; i < x.values.size(); i++)
1166 {
1167 x_length += scifir::pow(x.values[i] - y.values[i],2);
1168 }
1169 return T(scifir::sqrt(x_length));
1170 }
1171 else
1172 {
1173 return T();
1174 }
1175 }
1176
1177 float distance(const coordinates_nd<float>& x,const coordinates_nd<float>& y);
1178}
1179
1180template<typename T,typename U>
1182{
1183 if (x.values.size() == y.values.size())
1184 {
1185 for (int i = 0; i < x.values.size(); i++)
1186 {
1187 if (x.values[i] != y.values[i])
1188 {
1189 return false;
1190 }
1191 }
1192 return true;
1193 }
1194 else
1195 {
1196 return false;
1197 }
1198}
1199
1200template<typename T,typename U>
1202{
1203 return !(x == y);
1204}
1205
1206template<typename T>
1207bool operator ==(const scifir::coordinates_nd<T>& x, const string& init_coordinates_nd)
1208{
1209 scifir::coordinates_nd<T> y(init_coordinates_nd);
1210 return (x == y);
1211}
1212
1213template<typename T>
1214bool operator !=(const scifir::coordinates_nd<T>& x, const string& init_coordinates_nd)
1215{
1216 return !(x == init_coordinates_nd);
1217}
1218
1219template<typename T>
1220bool operator ==(const string& init_coordinates_nd, const scifir::coordinates_nd<T>& x)
1221{
1222 scifir::coordinates_nd<T> y(init_coordinates_nd);
1223 return (x == y);
1224}
1225
1226template<typename T>
1227bool operator !=(const string& init_coordinates_nd, const scifir::coordinates_nd<T>& x)
1228{
1229 return !(init_coordinates_nd == x);
1230}
1231
1232template<typename T>
1234{
1235 x += to_string(y);
1236}
1237
1238template<typename T>
1239string operator +(const string& x,const scifir::coordinates_nd<T>& y)
1240{
1241 return x + to_string(y);
1242}
1243
1244template<typename T>
1245string operator +(const scifir::coordinates_nd<T>& x,const string& y)
1246{
1247 return to_string(x) + y;
1248}
1249
1250template<typename T>
1251ostream& operator <<(ostream& os,const scifir::coordinates_nd<T>& x)
1252{
1253 return os << to_string(x);
1254}
1255
1256ostream& operator <<(ostream& os,const scifir::coordinates_nd<float>& x);
1257
1258template<typename T>
1260{
1261 char a[256];
1262 is.getline(a, 256);
1263 string b(a);
1264 boost::trim(b);
1266 return is;
1267}
1268
1269#endif // SCIFIR_UNITS_COORDINATES_COORDINATES_ND_HPP_INCLUDED
Class that allows to work with angles. Each angle sizes 4 bytes. Initialization string example: "20°"...
Definition angle.hpp:77
Class that represents the position in 3D spaces. The space can be a length or, for the case of imagin...
coordinates_nd(float new_r, const angle &new_theta, const angle &new_phi)
coordinates_nd(const vector< float > &new_values)
void move(float new_p, const angle &new_theta)
void move(const displacement_3d &x_displacement)
void set_position(const angle &new_latitude, const angle &new_longitude, float new_altitude)
void rotate_in_3d(int axis, const angle &new_theta)
void set_position(float new_x, float new_y)
coordinates_nd(float new_x, float new_y, float new_z)
void set_position(float new_p, const angle &new_theta)
void initialize_from_string(string init_coordinates_nd)
void set_position(float new_x, float new_y, float new_z)
coordinates_nd(coordinates_nd< float > &&x)
coordinates_nd(float new_p, const angle &new_theta, float new_z)
coordinates_nd(float new_p, const angle &new_theta)
void move(float new_p, const angle &new_theta, float new_z)
void move(const displacement_2d &x_displacement)
void move(float new_x, float new_y, float new_z)
bool is_nd(unsigned int i) const
void move(float new_r, const angle &new_theta, const angle &new_phi)
void set_position(float new_r, const angle &new_theta, const angle &new_phi)
void set_position(float new_p, const angle &new_theta, float new_z)
void move(float new_r, const vector< angle > &new_angles)
void move(const displacement_nd &x_displacement)
void move(float new_x, float new_y)
void rotate_in_2d(const angle &new_theta)
coordinates_nd(const string &init_coordinates_nd)
coordinates_nd(const coordinates_nd< float > &x)
coordinates_nd(float new_x, float new_y)
coordinates_nd(const angle &new_latitude, const angle &new_longitude, float new_altitude)
void set_position(const vector< float > &new_values)
coordinates_nd(coordinates_2d<>::type coordinates_type, const string &coord1, const string &coord2)
coordinates_nd(const scalar_unit &new_p, const angle &new_theta, scalar_unit new_z)
coordinates_nd(const coordinates_nd< T > &x)
coordinates_nd(const angle &new_latitude, const angle &new_longitude, const scalar_unit &new_altitude)
string display_geographical() const
void set_position(const scalar_unit &new_r, const angle &new_theta, const angle &new_phi)
void set_position(const scalar_unit &new_p, const angle &new_theta)
bool is_nd(int i) const
string display_spherical() const
coordinates_nd(const vector< U > &new_values)
scalar_unit get_altitude() const
void rotate_in_3d(int axis, const angle &new_theta)
latitude get_latitude() const
void move(const displacement_nd &x_displacement)
string display_cylindrical() const
static coordinates_nd< T > origin(const coordinates_nd< T > &origin, const coordinates_nd< T > &coordinates)
void rotate_in_2d(const angle &new_theta)
void move(const scalar_unit &new_x, const scalar_unit &new_y)
string display_cartesian_3d() const
coordinates_nd< T > & operator=(const coordinates_nd< T > &x_coordinates)
coordinates_nd(const scalar_unit &new_x, const scalar_unit &new_y)
void move(const scalar_unit &new_r, const vector< angle > &new_angles)
void move(const scalar_unit &new_p, const angle &new_theta)
coordinates_nd(coordinates_nd< T > &&x)
void set_position(const vector< scalar_unit > &new_values)
void set_position(const scalar_unit &new_x, const scalar_unit &new_y)
coordinates_nd(const scalar_unit &new_r, const angle &new_theta, const angle &new_phi)
coordinates_nd(const scalar_unit &new_p, const angle &new_theta)
void set_position(const angle &new_latitude, const angle &new_longitude, const scalar_unit &new_altitude)
void move(const scalar_unit &new_x, const scalar_unit &new_y, const scalar_unit &new_z)
coordinates_nd(const scalar_unit &new_x)
coordinates_nd(const string &init_coordinates_nd)
string display_cartesian_2d() const
void move(const displacement_2d &x_displacement)
void move(const displacement_3d &x_displacement)
void move(const scalar_unit &new_r, const angle &new_theta, const angle &new_phi)
longitude get_longitude() const
void move(const scalar_unit &new_p, const angle &new_theta, scalar_unit new_z)
void initialize_from_string(string init_coordinates_nd)
coordinates_nd(coordinates_3d<>::type coordinates_type, const string &coord1, const string &coord2, const string &coord3)
void set_position(const scalar_unit &new_x)
void move(const scalar_unit &new_x)
coordinates_nd(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_x, const scalar_unit &new_y, const scalar_unit &new_z)
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_nd< T > &y)
ostream & operator<<(ostream &os, const scifir::coordinates_nd< T > &x)
string operator+(const string &x, const scifir::coordinates_nd< T > &y)
bool operator==(const scifir::coordinates_nd< T > &x, const scifir::coordinates_nd< U > &y)
bool operator!=(const scifir::coordinates_nd< T > &x, const scifir::coordinates_nd< U > &y)
istream & operator>>(istream &is, scifir::coordinates_nd< T > &x)
The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
Definition address.cpp:6
bool is_latitude(const string &init_latitude)
Definition latitude.cpp:199
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++,...
Definition angle.cpp:431
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+...
Definition angle.hpp:252
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.
Definition aid.cpp:582
float distance(const coordinates_1d< float > &x, const coordinates_1d< float > &y)
string display_float(const float &value, int number_of_decimals)
Definition types.cpp:36
float acos_degree(float x)
Calculates the acos receiving x in degrees. It uses the acos() function of the standard library of C+...
Definition angle.hpp:247
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++,...
Definition angle.cpp:426
angle sqrt(const angle &x)
Calculates the square root of the angle x and returns that new angle.
Definition angle.cpp:416
bool is_angle(const string &init_angle)
Checks if some string is an initialization string of an angle.
Definition angle.cpp:336