![]() |
SuperNOVAS C++ API v1.6
High-precision C/C++ astrometry library
|
A 3D physical velocity vector in space. More...
#include <supernovas.h>
Public Member Functions | |
| Velocity (const double vel[3], double unit=1.0) | |
| Instantiates a new velocity vector from its xyz components, specified in the given physical unit. | |
| Velocity (double x_ms, double y_ms, double z_ms) | |
| Instantiates a new velocity vector from its xyz components. | |
| bool | equals (const Velocity &v, double precision=Unit::mm/Unit::s) const |
| Checks if this velocity is the same as another, within the specified precision. | |
| Velocity | inv () const |
| Returns the velocity with the same magnitude as this, but moving in the opposite direction. | |
| bool | operator!= (const Velocity &v) const |
| Checks if this velocity is the same as another, within 1 mm/s. | |
| Position | operator* (const Interval &t) const |
| Returns the vector travelled in the given time interval at this velocity. | |
| Velocity | operator+ (const Velocity &r) const |
| Returns the sum of this velocity and the specified other velocity. | |
| Velocity | operator- (const Velocity &r) const |
| Returns the difference of this velocity and the specified other velocity. | |
| bool | operator== (const Velocity &v) const |
| Checks if this velocity is the same as another, within 1 mm/s. | |
| ScalarVelocity | speed () const |
| Returns the speed (absolute value) of this velocity vector. | |
| std::string | to_string (int decimals=3) const override |
| Returns a string representation of this velocity with the requested decimal precision. | |
| Position | travel (const Interval &t) const |
| Returns the vector travelled in the given time interval at this velocity. | |
| Position | travel (double seconds) const |
| Returns the vector travelled in the given time interval at this velocity. | |
| 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 Velocity & | stationary () |
| Returns a reference to the statically defined zero velocity of a stationary object. | |
| static const Velocity & | undefined () |
| Returns a reference to the statically defined standard invalid velocity. | |
Additional Inherited Members | |
| 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; | |
| 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. | |
|
explicit |
Instantiates a new velocity vector from its xyz components.
| x_ms | [m/s] x component |
| y_ms | [m/s] y component |
| z_ms | [m/s] z component |
References supernovas::Vector::Vector(), supernovas::Validating::_valid, supernovas::Vector::abs(), and supernovas::Constant::c.
|
explicit |
Instantiates a new velocity vector from its xyz components, specified in the given physical unit.
| vel | The xyz 3-vector defining the components |
| unit | (optional) the physical unit (e.g. Unit::kms, or Unit::au / Unit::day) in which the components were specified (default: Unit:m / Unit::s = 1.0). |
References supernovas::Vector::Vector().
| bool supernovas::Velocity::equals | ( | const Velocity & | v, |
| double | precision = Unit::mm / Unit::s ) const |
Checks if this velocity is the same as another, within the specified precision.
| v | the reference velocity |
| precision | the precision for testing equality (default: 1 mm/s). |
References supernovas::Vector::equals().
Referenced by operator!=(), and operator==().
| Velocity supernovas::Velocity::inv | ( | ) | const |
Returns the velocity with the same magnitude as this, but moving in the opposite direction.
References supernovas::Vector::_component, and supernovas::Validating::is_valid().
| bool supernovas::Velocity::operator!= | ( | const Velocity & | v | ) | const |
Checks if this velocity is the same as another, within 1 mm/s.
| v | the reference velocity |
References equals(), supernovas::Unit::mm, and supernovas::Unit::sec.
Returns the vector travelled in the given time interval at this velocity.
| t | time interval |
References supernovas::Validating::is_valid(), and travel().
| Velocity supernovas::Velocity::operator+ | ( | const Velocity & | r | ) | const |
Returns the sum of this velocity and the specified other velocity.
The sum is calculated using the relativistic formula.
| r | the other velocity on the right-hand side. |
References supernovas::Validating::is_valid(), supernovas::Vector::x(), supernovas::Vector::y(), and supernovas::Vector::z().
| Velocity supernovas::Velocity::operator- | ( | const Velocity & | r | ) | const |
Returns the difference of this velocity and the specified other velocity.
The difference is calculated using the relativistic formula.
| r | the other velocity on the right-hand side. |
References supernovas::Validating::is_valid(), supernovas::Vector::x(), supernovas::Vector::y(), and supernovas::Vector::z().
| bool supernovas::Velocity::operator== | ( | const Velocity & | v | ) | const |
Checks if this velocity is the same as another, within 1 mm/s.
| v | the reference velocity |
References equals(), supernovas::Unit::mm, and supernovas::Unit::sec.
| ScalarVelocity supernovas::Velocity::speed | ( | ) | const |
Returns the speed (absolute value) of this velocity vector.
References supernovas::Vector::abs(), and supernovas::Validating::is_valid().
|
static |
Returns a reference to the statically defined zero velocity of a stationary object.
|
overridevirtual |
Returns a string representation of this velocity with the requested decimal precision.
| decimals | (optional) the number of decimnal places to print for the components |
Reimplemented from supernovas::Vector.
References supernovas::ScalarVelocity::to_string(), supernovas::Vector::x(), supernovas::Vector::y(), and supernovas::Vector::z().
Referenced by supernovas::GeocentricObserver::to_string(), supernovas::GeodeticObserver::to_string(), supernovas::Geometric::to_string(), and supernovas::SolarSystemObserver::to_string().
Returns the vector travelled in the given time interval at this velocity.
| t | time interval |
References supernovas::Interval::seconds(), and travel().
| Position supernovas::Velocity::travel | ( | double | seconds | ) | const |
Returns the vector travelled in the given time interval at this velocity.
| seconds | [s] time interval |
References supernovas::Validating::is_valid(), supernovas::Vector::x(), supernovas::Vector::y(), and supernovas::Vector::z().
Referenced by supernovas::Interval::operator*(), operator*(), and travel().
|
static |
Returns a reference to the statically defined standard invalid velocity.
This invalid velocity may be used inside any object that is invalid itself.
Referenced by supernovas::Frame::observer_ssb_velocity(), and supernovas::Orbital::velocity().