![]() |
SuperNOVAS C++ API v1.6
High-precision C/C++ astrometry library
|
A 3D physical position vector in space. More...
#include <supernovas.h>
Public Member Functions | |
| Position (const double pos[3], double unit=Unit::m) | |
| Instantiates a new 3D cartesian position vector from its components in S.I. | |
| Position (double x_m, double y_m, double z_m) | |
| Instantiates a new 3D cartesian position vector from its components in S.I. | |
| AstrometricPosition | as_astrometric (const Frame &frame, enum novas_reference_system system=NOVAS_TOD) const |
| Returns this equatorial position vector as an astrometric position, referenced to the specified time and Solar-system barycentric observer location. | |
| Coordinate | distance () const |
| Returns the distance to the location indicated by this position (that is the absolute value of this position vector). | |
| bool | equals (const Position &p, double precision) const |
| Checks if this position is the same as another, within the specified precision. | |
| Position | inv () const |
| Returns a position vector with the same magnitude as this, but in the opposite direction. | |
| bool | operator!= (const Position &p) const |
| Checks if this position is differs fro the specified other position by more than the 12th significant figure, or 1mm (whichever is larger). | |
| Position | operator+ (const Position &r) const |
| Returns the sum of this position and another (relative) position. | |
| Position | operator- (const Position &r) const |
| Returns the difference of this position and another position. | |
| Velocity | operator/ (const Interval &dt) const |
| Returns the velocity vector that is equal to this position vector travelled under the specified time interval. | |
| bool | operator== (const Position &p) const |
| Checks if this position is the same as the specified other position to 12 significant figures, or 1mm (whichever is larger). | |
| Spherical | to_spherical () const |
| Converts this position vector to Spherical coordinates. | |
| virtual std::string | to_string (int decimals=3) const override |
| Returns a string represetation of this position vector, optionally setting the number of decimal places to show for each component. | |
| Public Member Functions inherited from supernovas::Vector | |
| virtual | ~Vector () |
| const double * | _array () const |
| Returns the underlying double[3] C array that stores the components of this vector internally. | |
| double | abs () const |
| Returns the absolute value (length / magnitude) of this vector. | |
| double | dot (const Vector &v) const |
| Returns the dot product of this vector and the specified other vector. | |
| bool | is_zero () const |
| Checks if this verctor is a null vector, that is all of its components are zero. | |
| Vector | operator* (double r) const |
| Scales a vector by a factor, for example to cast it to/from a physical unit. | |
| double | operator[] (int idx) const |
| Returns the component at the specified index. | |
| Angle | phi () const |
| Returns the azumithal angle of this vector. | |
| double | projection_on (const Vector &v) const |
| Returns the projection of this vector along the direction of another vector. | |
| Vector | scaled (double factor) const |
| Returns a rescaled version of this vector, for example to cast it to/from a physical unit. | |
| Angle | theta () const |
| Returns the polar angleof this vector, that is the angle from the z axis. | |
| Vector | unit_vector () const |
| Returns a unit vector in the direction of this vector. | |
| double | x () const |
| Returns the x component of this vector. | |
| double | y () const |
| Returns the y component of this vector. | |
| double | z () const |
| Returns the z component of this vector. | |
| Public Member Functions inherited from supernovas::Validating | |
| bool | is_valid () const |
| Returns the previously set 'valid' stae of the implementing instance. | |
| operator bool () const | |
| Objects that implement Validating can be used in conditionals directly, without explicitly calling is_valid(). | |
Static Public Member Functions | |
| static const Position & | origin () |
| Returns a reference to the statically define position at the origin (that is a null posiution vector). | |
| static const Position & | undefined () |
| Returns a reference to a statically defined standard invalid position vector. | |
Protected Member Functions | |
| Position () | |
| Instantiates an undefined position vector. | |
| Protected Member Functions inherited from supernovas::Vector | |
| Vector () | |
| Instantiates an undefined vector. | |
| Vector (double x, double y, double z) | |
| Instantiates a vector from its cartesian components. | |
| bool | equals (const Vector &v, double precision) const |
| Checks if this vector is the same as another vector, within the specified precision. | |
| Protected Member Functions inherited from supernovas::Validating | |
| Validating () | |
| dummy constructor; | |
Additional Inherited Members | |
| Protected Attributes inherited from supernovas::Vector | |
| double | _component [3] |
| [arb.u] Array containing the x, y, z components. | |
| Protected Attributes inherited from supernovas::Validating | |
| bool | _valid = false |
| the state variable. | |
|
inlineprotected |
Instantiates an undefined position vector.
References supernovas::Vector::Vector().
Referenced by supernovas::AstrometricPosition::AstrometricPosition(), equals(), inv(), operator!=(), operator+(), operator-(), operator==(), origin(), supernovas::AstrometricPosition::reference(), supernovas::AstrometricPosition::referenced_to(), and undefined().
|
explicit |
Instantiates a new 3D cartesian position vector from its components in S.I.
units.
| x_m | [m] x component |
| y_m | [m] y component |
| z_m | [m] z component |
References supernovas::Vector::Vector(), and supernovas::Validating::_valid.
|
explicit |
Instantiates a new 3D cartesian position vector from its components in S.I.
units.
| pos | position 3-vector expressed in some physical unit |
| unit | the physical unit, in which the components are given, such as Unit::m or Unit::au. |
References supernovas::Vector::Vector().
| AstrometricPosition supernovas::Position::as_astrometric | ( | const Frame & | frame, |
| enum novas_reference_system | system = NOVAS_TOD ) const |
Returns this equatorial position vector as an astrometric position, referenced to the specified time and Solar-system barycentric observer location.
IMPORTANT! Use this method only if you are 100% certain that the position represented by this instance is an equatorial rectangular position vector in the specified observing frame.
| Observing frames | Observing frame (observer location and time of observation) |
| system | (optional) Equatorial coordinate reference system type used for the position and observer location (default: TOD). |
References supernovas::Validating::is_valid().
| Coordinate supernovas::Position::distance | ( | ) | const |
Returns the distance to the location indicated by this position (that is the absolute value of this position vector).
References supernovas::Vector::abs(), and supernovas::Validating::is_valid().
Referenced by supernovas::AstrometricPosition::obs_time().
| bool supernovas::Position::equals | ( | const Position & | p, |
| double | precision ) const |
Checks if this position is the same as another, within the specified precision.
| p | the reference position |
| precision | the precision for testing equality. |
References Position(), and supernovas::Vector::equals().
Referenced by supernovas::Site::equals(), and operator==().
| Position supernovas::Position::inv | ( | ) | const |
Returns a position vector with the same magnitude as this, but in the opposite direction.
References Position(), supernovas::Vector::_component, and supernovas::Validating::is_valid().
| bool supernovas::Position::operator!= | ( | const Position & | p | ) | const |
Checks if this position is differs fro the specified other position by more than the 12th significant figure, or 1mm (whichever is larger).
| p | the reference position |
References Position().
Returns the sum of this position and another (relative) position.
| r | the other position on the right-hand side |
References Position(), supernovas::Validating::is_valid(), supernovas::Vector::x(), supernovas::Vector::y(), and supernovas::Vector::z().
Returns the difference of this position and another position.
| r | the other position on the right-hand side |
References Position(), supernovas::Validating::is_valid(), supernovas::Vector::x(), supernovas::Vector::y(), and supernovas::Vector::z().
Returns the velocity vector that is equal to this position vector travelled under the specified time interval.
| dt | the time interval on the right-hand-side of '/'. |
References supernovas::Vector::_component, supernovas::Validating::is_valid(), and supernovas::Interval::seconds().
| bool supernovas::Position::operator== | ( | const Position & | p | ) | const |
Checks if this position is the same as the specified other position to 12 significant figures, or 1mm (whichever is larger).
| p | the reference position |
References Position(), supernovas::Vector::abs(), equals(), and supernovas::Unit::mm.
|
static |
Returns a reference to the statically define position at the origin (that is a null posiution vector).
References Position().
Referenced by supernovas::AstrometricPosition::referenced_to_ssb().
| Spherical supernovas::Position::to_spherical | ( | ) | const |
Converts this position vector to Spherical coordinates.
References supernovas::Vector::_component, and supernovas::Validating::is_valid().
|
overridevirtual |
Returns a string represetation of this position vector, optionally setting the number of decimal places to show for each component.
| decimals | (optional) decimal places to print for the components (default: 3). |
Reimplemented from supernovas::Vector.
Reimplemented in supernovas::AstrometricPosition.
References supernovas::Coordinate::to_string(), supernovas::Vector::x(), supernovas::Vector::y(), and supernovas::Vector::z().
Referenced by supernovas::AstrometricPosition::to_string(), supernovas::GeocentricObserver::to_string(), supernovas::Geometric::to_string(), and supernovas::SolarSystemObserver::to_string().
|
static |
Returns a reference to a statically defined standard invalid position vector.
This invalid vector may be used inside any object that is invalid itself.
References Position().
Referenced by supernovas::Apparent::astrometric_position(), supernovas::Frame::observer_ssb_position(), and supernovas::Orbital::position().