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
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | List of all members
scifir::coordinates_nd< T > Class Template Reference

#include <coordinates_nd.hpp>

Public Member Functions

 coordinates_nd ()
 
 coordinates_nd (const coordinates_nd< T > &x)
 
 coordinates_nd (coordinates_nd< T > &&x)
 
template<typename U >
 coordinates_nd (const vector< U > &new_values)
 
 coordinates_nd (const scalar_unit &new_x)
 
 coordinates_nd (const scalar_unit &new_x, const scalar_unit &new_y)
 
 coordinates_nd (const scalar_unit &new_p, const angle &new_theta)
 
 coordinates_nd (const scalar_unit &new_x, const scalar_unit &new_y, const scalar_unit &new_z)
 
 coordinates_nd (const scalar_unit &new_p, const angle &new_theta, scalar_unit new_z)
 
 coordinates_nd (const scalar_unit &new_r, const angle &new_theta, const angle &new_phi)
 
 coordinates_nd (const angle &new_latitude, const angle &new_longitude, const scalar_unit &new_altitude)
 
 coordinates_nd (coordinates_2d<>::type coordinates_type, const string &coord1, const string &coord2)
 
 coordinates_nd (coordinates_3d<>::type coordinates_type, const string &coord1, const string &coord2, const string &coord3)
 
 coordinates_nd (const string &init_coordinates_nd)
 
coordinates_nd< T > & operator= (const coordinates_nd< T > &x_coordinates)
 
coordinates_nd< T > & operator= (coordinates_nd< T > &&x_coordinates)
 
coordinates_nd< T > & operator= (const string &init_coordinates_nd)
 
bool is_nd (int i) const
 
int get_nd () const
 
T get_p () const
 
angle get_theta () const
 
T get_r () const
 
angle get_phi () const
 
latitude get_latitude () const
 
longitude get_longitude () const
 
scalar_unit get_altitude () const
 
void set_position (const scalar_unit &new_x)
 
void set_position (const scalar_unit &new_x, const scalar_unit &new_y)
 
void set_position (const scalar_unit &new_p, const angle &new_theta)
 
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 angle &new_latitude, const angle &new_longitude, const scalar_unit &new_altitude)
 
void set_position (const vector< scalar_unit > &new_values)
 
void rotate_in_2d (const angle &new_theta)
 
void rotate_in_3d (int axis, const angle &new_theta)
 
void move (const scalar_unit &new_x)
 
void move (const displacement_2d &x_displacement)
 
void move (const scalar_unit &new_x, const scalar_unit &new_y)
 
void move (const scalar_unit &new_p, const angle &new_theta)
 
void move (const displacement_3d &x_displacement)
 
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)
 
void move (const displacement_nd &x_displacement)
 
void move (const scalar_unit &new_r, const vector< angle > &new_angles)
 
T distance_to_origin () const
 
string display_cartesian_2d () const
 
string display_polar () const
 
string display_cartesian_3d () const
 
string display_cylindrical () const
 
string display_spherical () const
 
string display_geographical () const
 

Static Public Member Functions

static coordinates_nd< Torigin (const coordinates_nd< T > &origin, const coordinates_nd< T > &coordinates)
 

Public Attributes

vector< Tvalues
 

Private Member Functions

void initialize_from_string (string init_coordinates_nd)
 

Detailed Description

template<typename T = length>
class scifir::coordinates_nd< T >

Definition at line 19 of file coordinates_nd.hpp.

Constructor & Destructor Documentation

◆ coordinates_nd() [1/14]

template<typename T = length>
scifir::coordinates_nd< T >::coordinates_nd ( )
inline

Definition at line 22 of file coordinates_nd.hpp.

22 : values()
23 {}

◆ coordinates_nd() [2/14]

template<typename T = length>
scifir::coordinates_nd< T >::coordinates_nd ( const coordinates_nd< T > &  x)
inline

Definition at line 25 of file coordinates_nd.hpp.

25 : values(x.values)
26 {}

◆ coordinates_nd() [3/14]

template<typename T = length>
scifir::coordinates_nd< T >::coordinates_nd ( coordinates_nd< T > &&  x)
inline

Definition at line 28 of file coordinates_nd.hpp.

28 : values(std::move(x.values))
29 {}

◆ coordinates_nd() [4/14]

template<typename T = length>
template<typename U >
scifir::coordinates_nd< T >::coordinates_nd ( const vector< U > &  new_values)
inlineexplicit

Definition at line 32 of file coordinates_nd.hpp.

32 : values()
33 {
34 for(const U& x_value : new_values)
35 {
36 values.push_back(T(x_value));
37 }
38 }

◆ coordinates_nd() [5/14]

template<typename T = length>
scifir::coordinates_nd< T >::coordinates_nd ( const scalar_unit new_x)
inlineexplicit

Definition at line 40 of file coordinates_nd.hpp.

40 : values()
41 {
42 values.push_back(T(new_x));
43 }

◆ coordinates_nd() [6/14]

template<typename T = length>
scifir::coordinates_nd< T >::coordinates_nd ( const scalar_unit new_x,
const scalar_unit new_y 
)
inlineexplicit

Definition at line 45 of file coordinates_nd.hpp.

45 : values()
46 {
47 values.push_back(T(new_x));
48 values.push_back(T(new_y));
49 }

◆ coordinates_nd() [7/14]

template<typename T = length>
scifir::coordinates_nd< T >::coordinates_nd ( const scalar_unit new_p,
const angle new_theta 
)
inlineexplicit

Definition at line 51 of file coordinates_nd.hpp.

51 : values()
52 {
53 set_position(new_p,new_theta);
54 }
void set_position(const scalar_unit &new_x)

◆ coordinates_nd() [8/14]

template<typename T = length>
scifir::coordinates_nd< T >::coordinates_nd ( const scalar_unit new_x,
const scalar_unit new_y,
const scalar_unit new_z 
)
inlineexplicit

Definition at line 56 of file coordinates_nd.hpp.

56 : values()
57 {
58 values.push_back(T(new_x));
59 values.push_back(T(new_y));
60 values.push_back(T(new_z));
61 }

◆ coordinates_nd() [9/14]

template<typename T = length>
scifir::coordinates_nd< T >::coordinates_nd ( const scalar_unit new_p,
const angle new_theta,
scalar_unit  new_z 
)
inlineexplicit

Definition at line 63 of file coordinates_nd.hpp.

63 : values()
64 {
65 set_position(new_p,new_theta,new_z);
66 }

◆ coordinates_nd() [10/14]

template<typename T = length>
scifir::coordinates_nd< T >::coordinates_nd ( const scalar_unit new_r,
const angle new_theta,
const angle new_phi 
)
inlineexplicit

Definition at line 68 of file coordinates_nd.hpp.

68 : values()
69 {
70 set_position(new_r,new_theta,new_phi);
71 }

◆ coordinates_nd() [11/14]

template<typename T = length>
scifir::coordinates_nd< T >::coordinates_nd ( const angle new_latitude,
const angle new_longitude,
const scalar_unit new_altitude 
)
inlineexplicit

Definition at line 73 of file coordinates_nd.hpp.

73 : values()
74 {
75 set_position(new_latitude,new_longitude,new_altitude);
76 }

◆ coordinates_nd() [12/14]

template<typename T = length>
scifir::coordinates_nd< T >::coordinates_nd ( coordinates_2d<>::type  coordinates_type,
const string coord1,
const string coord2 
)
inlineexplicit

Definition at line 78 of file coordinates_nd.hpp.

79 {
80 if (coordinates_type == coordinates_2d<>::CARTESIAN)
81 {
82 set_position(T(coord1),T(coord2));
83 }
84 else if (coordinates_type == coordinates_2d<>::POLAR)
85 {
86 set_position(T(coord1),angle(coord2));
87 }
88 }

◆ coordinates_nd() [13/14]

template<typename T = length>
scifir::coordinates_nd< T >::coordinates_nd ( coordinates_3d<>::type  coordinates_type,
const string coord1,
const string coord2,
const string coord3 
)
inlineexplicit

Definition at line 90 of file coordinates_nd.hpp.

91 {
92 if (coordinates_type == coordinates_3d<>::CARTESIAN)
93 {
94 set_position(T(coord1),T(coord2),T(coord3));
95 }
96 else if (coordinates_type == coordinates_3d<>::CYLINDRICAL)
97 {
98 set_position(T(coord1),angle(coord2),T(coord3));
99 }
100 else if (coordinates_type == coordinates_3d<>::SPHERICAL)
101 {
102 set_position(T(coord1),angle(coord2),angle(coord3));
103 }
104 else if (coordinates_type == coordinates_3d<>::GEODESIC)
105 {
106 set_position(angle(coord1),angle(coord2),T(coord3));
107 }
108 }

◆ coordinates_nd() [14/14]

template<typename T = length>
scifir::coordinates_nd< T >::coordinates_nd ( const string init_coordinates_nd)
inlineexplicit

Definition at line 110 of file coordinates_nd.hpp.

110 : values()
111 {
112 initialize_from_string(init_coordinates_nd);
113 }
void initialize_from_string(string init_coordinates_nd)

Member Function Documentation

◆ display_cartesian_2d()

template<typename T = length>
string scifir::coordinates_nd< T >::display_cartesian_2d ( ) const
inline

Definition at line 438 of file coordinates_nd.hpp.

439 {
440 if (values.size() == 2)
441 {
442 ostringstream out;
443 out << "(" << values[0] << "," << values[1] << ")";
444 return out.str();
445 }
446 else
447 {
448 return "[no-2d]";
449 }
450 }

◆ display_cartesian_3d()

template<typename T = length>
string scifir::coordinates_nd< T >::display_cartesian_3d ( ) const
inline

Definition at line 466 of file coordinates_nd.hpp.

467 {
468 if (values.size() == 3)
469 {
470 ostringstream out;
471 out << "(" << values[0] << "," << values[1] << "," << values[2] << ")";
472 return out.str();
473 }
474 else
475 {
476 return "[no-3d]";
477 }
478 }

◆ display_cylindrical()

template<typename T = length>
string scifir::coordinates_nd< T >::display_cylindrical ( ) const
inline

Definition at line 480 of file coordinates_nd.hpp.

481 {
482 if (values.size() == 3)
483 {
484 ostringstream out;
485 out << "(" << get_p() << "," << get_theta() << "," << values[2] << ")";
486 return out.str();
487 }
488 else
489 {
490 return "[no-3d]";
491 }
492 }

◆ display_geographical()

template<typename T = length>
string scifir::coordinates_nd< T >::display_geographical ( ) const
inline

Definition at line 508 of file coordinates_nd.hpp.

509 {
510 if (values.size() == 3)
511 {
512 ostringstream out;
513 out << "(" << get_latitude() << "," << get_longitude() << "," << get_altitude() << ")";
514 return out.str();
515 }
516 else
517 {
518 return "[no-3d]";
519 }
520 }
scalar_unit get_altitude() const
latitude get_latitude() const
longitude get_longitude() const

◆ display_polar()

template<typename T = length>
string scifir::coordinates_nd< T >::display_polar ( ) const
inline

Definition at line 452 of file coordinates_nd.hpp.

453 {
454 if (values.size() == 2)
455 {
456 ostringstream out;
457 out << "(" << get_p() << "," << get_theta() << ")";
458 return out.str();
459 }
460 else
461 {
462 return "[no-2d]";
463 }
464 }

◆ display_spherical()

template<typename T = length>
string scifir::coordinates_nd< T >::display_spherical ( ) const
inline

Definition at line 494 of file coordinates_nd.hpp.

495 {
496 if (values.size() == 3)
497 {
498 ostringstream out;
499 out << "(" << get_r() << "," << get_theta() << "," << get_phi() << ")";
500 return out.str();
501 }
502 else
503 {
504 return "[no-3d]";
505 }
506 }

◆ distance_to_origin()

template<typename T = length>
T scifir::coordinates_nd< T >::distance_to_origin ( ) const
inline

Definition at line 428 of file coordinates_nd.hpp.

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 }
scalar_unit pow(const scalar_unit &x, int exponent)
Exponentiates a scalar_unit to some numeric type, the dimensions are also exponentiated.
angle sqrt(const angle &x)
Calculates the square root of the angle x and returns that new angle.
Definition angle.cpp:416

◆ get_altitude()

template<typename T = length>
scalar_unit scifir::coordinates_nd< T >::get_altitude ( ) const
inline

Definition at line 225 of file coordinates_nd.hpp.

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 }
scalar_unit ECEF_to_LLA_altitude(const scalar_unit &x, scalar_unit y, const scalar_unit &z)

◆ get_latitude()

template<typename T = length>
latitude scifir::coordinates_nd< T >::get_latitude ( ) const
inline

Definition at line 201 of file coordinates_nd.hpp.

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 }
latitude ECEF_to_LLA_latitude(const scalar_unit &x, scalar_unit y, const scalar_unit &z)

◆ get_longitude()

template<typename T = length>
longitude scifir::coordinates_nd< T >::get_longitude ( ) const
inline

Definition at line 213 of file coordinates_nd.hpp.

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 }
longitude ECEF_to_LLA_longitude(const scalar_unit &x, scalar_unit y, const scalar_unit &z)

◆ get_nd()

template<typename T = length>
int scifir::coordinates_nd< T >::get_nd ( ) const
inline

Definition at line 148 of file coordinates_nd.hpp.

149 {
150 return values.size();
151 }

◆ get_p()

template<typename T = length>
T scifir::coordinates_nd< T >::get_p ( ) const
inline

Definition at line 153 of file coordinates_nd.hpp.

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 }

◆ get_phi()

template<typename T = length>
angle scifir::coordinates_nd< T >::get_phi ( ) const
inline

Definition at line 189 of file coordinates_nd.hpp.

190 {
191 if (get_nd() == 3)
192 {
193 return angle(scifir::acos_degree(float(values[2]/scifir::sqrt(scifir::pow(values[0],2) + scifir::pow(values[1],2) + scifir::pow(values[2],2)))));
194 }
195 else
196 {
197 return angle();
198 }
199 }
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

◆ get_r()

template<typename T = length>
T scifir::coordinates_nd< T >::get_r ( ) const
inline

Definition at line 177 of file coordinates_nd.hpp.

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 }

◆ get_theta()

template<typename T = length>
angle scifir::coordinates_nd< T >::get_theta ( ) const
inline

Definition at line 165 of file coordinates_nd.hpp.

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 }
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

◆ initialize_from_string()

template<typename T = length>
void scifir::coordinates_nd< T >::initialize_from_string ( string  init_coordinates_nd)
inlineprivate

Definition at line 525 of file coordinates_nd.hpp.

526 {
527 vector<string> init_values;
528 if (init_coordinates_nd.front() == '(')
529 {
530 init_coordinates_nd.erase(0,1);
531 }
532 if (init_coordinates_nd.back() == ')')
533 {
534 init_coordinates_nd.erase(init_coordinates_nd.size()-1,1);
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 {
548 set_position(T(init_values[0]),angle(init_values[1]));
549 }
550 else
551 {
552 set_position(T(init_values[0]),T(init_values[1]));
553 }
554 }
555 else if (init_values.size() == 3)
556 {
557 if (is_latitude(init_values[0]))
558 {
559 if (is_longitude(init_values[1]))
560 {
561 if (!is_angle(init_values[2]))
562 {
563 set_position(angle(init_values[0]),angle(init_values[1]),T(init_values[2]));
564 }
565 }
566 }
567 else
568 {
569 if (is_angle(init_values[1]))
570 {
571 if (is_angle(init_values[2]))
572 {
573 set_position(T(init_values[0]),angle(init_values[1]),angle(init_values[2]));
574 }
575 else
576 {
577 set_position(T(init_values[0]),angle(init_values[1]),T(init_values[2]));
578 }
579 }
580 else
581 {
582 if (!is_angle(init_values[2]))
583 {
584 set_position(T(init_values[0]),T(init_values[1]),T(init_values[2]));
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 }
bool is_latitude(const string &init_latitude)
Definition latitude.cpp:199
bool is_longitude(const string &init_longitude)
bool is_angle(const string &init_angle)
Checks if some string is an initialization string of an angle.
Definition angle.cpp:336

◆ is_nd()

template<typename T = length>
bool scifir::coordinates_nd< T >::is_nd ( int  i) const
inline

Definition at line 143 of file coordinates_nd.hpp.

144 {
145 return values.size() == i;
146 }

◆ move() [1/10]

template<typename T = length>
void scifir::coordinates_nd< T >::move ( const displacement_2d x_displacement)
inline

Definition at line 343 of file coordinates_nd.hpp.

344 {
345 if (values.size() == 2)
346 {
347 values[0] += x_displacement.x_projection();
348 values[1] += x_displacement.y_projection();
349 }
350 }

◆ move() [2/10]

template<typename T = length>
void scifir::coordinates_nd< T >::move ( const displacement_3d x_displacement)
inline

Definition at line 370 of file coordinates_nd.hpp.

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 }

◆ move() [3/10]

template<typename T = length>
void scifir::coordinates_nd< T >::move ( const displacement_nd x_displacement)
inline

Definition at line 411 of file coordinates_nd.hpp.

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 }

◆ move() [4/10]

template<typename T = length>
void scifir::coordinates_nd< T >::move ( const scalar_unit new_p,
const angle new_theta 
)
inline

Definition at line 361 of file coordinates_nd.hpp.

362 {
363 if (values.size() == 2)
364 {
365 values[0] += new_p * scifir::cos(new_theta);
366 values[1] += new_p * scifir::sin(new_theta);
367 }
368 }
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
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

◆ move() [5/10]

template<typename T = length>
void scifir::coordinates_nd< T >::move ( const scalar_unit new_p,
const angle new_theta,
scalar_unit  new_z 
)
inline

Definition at line 390 of file coordinates_nd.hpp.

391 {
392 if (values.size() == 3)
393 {
394 new_z.change_dimensions(new_p);
395 values[0] += T(new_p * scifir::cos(new_theta));
396 values[1] += T(new_p * scifir::sin(new_theta));
397 values[2] += new_z;
398 }
399 }

◆ move() [6/10]

template<typename T = length>
void scifir::coordinates_nd< T >::move ( const scalar_unit new_r,
const angle new_theta,
const angle new_phi 
)
inline

Definition at line 401 of file coordinates_nd.hpp.

402 {
403 if (values.size() == 3)
404 {
405 values[0] += T(new_r * scifir::cos(new_theta) * scifir::sin(new_phi));
406 values[1] += T(new_r * scifir::sin(new_theta) * scifir::sin(new_phi));
407 values[2] += T(new_r * scifir::cos(new_phi));
408 }
409 }

◆ move() [7/10]

template<typename T = length>
void scifir::coordinates_nd< T >::move ( const scalar_unit new_r,
const vector< angle > &  new_angles 
)
inline

Definition at line 422 of file coordinates_nd.hpp.

423 {
424 displacement_nd x_displacement = displacement_nd(new_r,new_angles);
425 move(x_displacement);
426 }
void move(const scalar_unit &new_x)

◆ move() [8/10]

template<typename T = length>
void scifir::coordinates_nd< T >::move ( const scalar_unit new_x)
inline

Definition at line 335 of file coordinates_nd.hpp.

336 {
337 if (values.size() == 1)
338 {
339 values[0] += new_x;
340 }
341 }

◆ move() [9/10]

template<typename T = length>
void scifir::coordinates_nd< T >::move ( const scalar_unit new_x,
const scalar_unit new_y 
)
inline

Definition at line 352 of file coordinates_nd.hpp.

353 {
354 if (values.size() == 2)
355 {
356 values[0] += new_x;
357 values[1] += new_y;
358 }
359 }

◆ move() [10/10]

template<typename T = length>
void scifir::coordinates_nd< T >::move ( const scalar_unit new_x,
const scalar_unit new_y,
const scalar_unit new_z 
)
inline

Definition at line 380 of file coordinates_nd.hpp.

381 {
382 if (values.size() == 3)
383 {
384 values[0] += new_x;
385 values[1] += new_y;
386 values[2] += new_z;
387 }
388 }

◆ operator=() [1/3]

template<typename T = length>
coordinates_nd< T > & scifir::coordinates_nd< T >::operator= ( const coordinates_nd< T > &  x_coordinates)
inline

Definition at line 115 of file coordinates_nd.hpp.

116 {
117 values = x_coordinates.values;
118 return *this;
119 }

◆ operator=() [2/3]

template<typename T = length>
coordinates_nd< T > & scifir::coordinates_nd< T >::operator= ( const string init_coordinates_nd)
inline

Definition at line 127 of file coordinates_nd.hpp.

128 {
129 initialize_from_string(init_coordinates_nd);
130 return *this;
131 }

◆ operator=() [3/3]

template<typename T = length>
coordinates_nd< T > & scifir::coordinates_nd< T >::operator= ( coordinates_nd< T > &&  x_coordinates)
inline

Definition at line 121 of file coordinates_nd.hpp.

122 {
123 values = std::move(x_coordinates.values);
124 return *this;
125 }

◆ origin()

template<typename T = length>
static coordinates_nd< T > scifir::coordinates_nd< T >::origin ( const coordinates_nd< T > &  origin,
const coordinates_nd< T > &  coordinates 
)
inlinestatic

Definition at line 133 of file coordinates_nd.hpp.

134 {
135 coordinates_nd<T> new_coordinates(origin);
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 }
static coordinates_nd< T > origin(const coordinates_nd< T > &origin, const coordinates_nd< T > &coordinates)

◆ rotate_in_2d()

template<typename T = length>
void scifir::coordinates_nd< T >::rotate_in_2d ( const angle new_theta)
inline

Definition at line 296 of file coordinates_nd.hpp.

297 {
298 if (get_nd() == 2)
299 {
300 T x_coord = values[0];
301 T y_coord = values[1];
302 values[0] = x_coord * scifir::cos(new_theta) - y_coord * scifir::sin(new_theta);
303 values[1] = x_coord * scifir::sin(new_theta) + y_coord * scifir::cos(new_theta);
304 }
305 }

◆ rotate_in_3d()

template<typename T = length>
void scifir::coordinates_nd< T >::rotate_in_3d ( int  axis,
const angle new_theta 
)
inline

Definition at line 307 of file coordinates_nd.hpp.

308 {
309 if (get_nd() == 3)
310 {
311 if (axis == 1)
312 {
313 T y_coord = values[1];
314 T z_coord = values[2];
315 values[1] = y_coord * scifir::cos(new_theta) - z_coord * scifir::sin(new_theta);
316 values[2] = y_coord * scifir::sin(new_theta) + z_coord * scifir::cos(new_theta);
317 }
318 else if (axis == 2)
319 {
320 T x_coord = values[0];
321 T z_coord = values[2];
322 values[0] = x_coord * scifir::cos(new_theta) - z_coord * scifir::sin(new_theta);
323 values[2] = x_coord * scifir::sin(new_theta) + z_coord * scifir::cos(new_theta);
324 }
325 else if (axis == 3)
326 {
327 T x_coord = values[0];
328 T y_coord = values[1];
329 values[0] = x_coord * scifir::cos(new_theta) - y_coord * scifir::sin(new_theta);
330 values[1] = x_coord * scifir::sin(new_theta) + y_coord * scifir::cos(new_theta);
331 }
332 }
333 }

◆ set_position() [1/8]

template<typename T = length>
void scifir::coordinates_nd< T >::set_position ( const angle new_latitude,
const angle new_longitude,
const scalar_unit new_altitude 
)
inline

Definition at line 282 of file coordinates_nd.hpp.

283 {
284 values.clear();
285 values.push_back(T(new_altitude * scifir::cos(new_latitude) * scifir::cos(new_longitude)));
286 values.push_back(T(new_altitude * scifir::cos(new_latitude) * scifir::sin(new_longitude)));
287 values.push_back(T(new_altitude * scifir::sin(new_latitude)));
288 }

◆ set_position() [2/8]

template<typename T = length>
void scifir::coordinates_nd< T >::set_position ( const scalar_unit new_p,
const angle new_theta 
)
inline

Definition at line 250 of file coordinates_nd.hpp.

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 }

◆ set_position() [3/8]

template<typename T = length>
void scifir::coordinates_nd< T >::set_position ( const scalar_unit new_p,
const angle new_theta,
scalar_unit  new_z 
)
inline

Definition at line 265 of file coordinates_nd.hpp.

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 }

◆ set_position() [4/8]

template<typename T = length>
void scifir::coordinates_nd< T >::set_position ( const scalar_unit new_r,
const angle new_theta,
const angle new_phi 
)
inline

Definition at line 274 of file coordinates_nd.hpp.

275 {
276 values.clear();
277 values.push_back(T(new_r * scifir::cos(new_theta) * scifir::sin(new_phi)));
278 values.push_back(T(new_r * scifir::sin(new_theta) * scifir::sin(new_phi)));
279 values.push_back(T(new_r * scifir::cos(new_phi)));
280 }

◆ set_position() [5/8]

template<typename T = length>
void scifir::coordinates_nd< T >::set_position ( const scalar_unit new_x)
inline

Definition at line 237 of file coordinates_nd.hpp.

238 {
239 values.clear();
240 values.push_back(T(new_x));
241 }

◆ set_position() [6/8]

template<typename T = length>
void scifir::coordinates_nd< T >::set_position ( const scalar_unit new_x,
const scalar_unit new_y 
)
inline

Definition at line 243 of file coordinates_nd.hpp.

244 {
245 values.clear();
246 values.push_back(T(new_x));
247 values.push_back(T(new_y));
248 }

◆ set_position() [7/8]

template<typename T = length>
void scifir::coordinates_nd< T >::set_position ( const scalar_unit new_x,
const scalar_unit new_y,
const scalar_unit new_z 
)
inline

Definition at line 257 of file coordinates_nd.hpp.

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 }

◆ set_position() [8/8]

template<typename T = length>
void scifir::coordinates_nd< T >::set_position ( const vector< scalar_unit > &  new_values)
inline

Definition at line 290 of file coordinates_nd.hpp.

291 {
292 values.clear();
293 values = new_values;
294 }

Member Data Documentation

◆ values

template<typename T = length>
vector<T> scifir::coordinates_nd< T >::values

Definition at line 522 of file coordinates_nd.hpp.


The documentation for this class was generated from the following file: