52 #ifndef __PCL_Position_h
53 #define __PCL_Position_h
104 , muAlpha( x.muAlpha )
105 , muDelta( x.muDelta )
160 double properMotionRA = 0,
double properMotionDec = 0,
162 double radialVelocity = 0,
164 : alpha( ((ra =
Mod( ra, 360.0 )) < 0) ? ra + 360 : ra )
165 , delta(
Range( dec, -90.0, +90.0 ) )
166 , muAlpha( properMotionRA )
167 , muDelta( properMotionDec )
169 , v( radialVelocity )
176 uint64 m_uniqueId = UniqueId();
199 double a = ea_eq_radius_IAU2009;
200 double f = ea_flattening_IERS2010;
202 bool cioBased =
false;
207 constexpr
static double ea_eq_radius_IAU2009 = 6378136.6;
212 constexpr
static double ea_flattening_IERS2010 = 1/298.25642;
282 double equatorialRadius = ea_eq_radius_IAU2009,
283 double flattening = ea_flattening_IERS2010,
285 bool useCIO =
false )
286 : lambda( ((longitude =
Mod( longitude, 360.0 )) < 0) ? longitude + 360 : longitude )
287 , phi(
Range( latitude, -90.0, +90.0 ) )
288 , h(
Max( 0.0, height ) )
289 , a(
Max( 0.0, equatorialRadius ) )
290 , f(
Max( 0.0, flattening ) )
291 , r0( regionalCenter )
417 (void)Geometric( H );
431 (void)Geometric( S );
444 return True( H ).L2Norm();
462 return True( S ).L2Norm();
474 (void)Geometric( H );
819 return m_usePolarMotion;
828 m_usePolarMotion = enable;
837 EnablePolarMotion( !disable );
1011 InitEquinoxBasedParameters();
1024 InitEquinoxBasedParameters();
1037 InitCIOBasedParameters();
1051 InitCIOBasedParameters();
1064 InitEquinoxBasedParameters();
1065 return Vector( m_X, m_Y );
1096 InitEquinoxBasedParameters();
1108 InitEquinoxBasedParameters();
1120 InitEquinoxBasedParameters();
1132 InitEquinoxBasedParameters();
1142 if ( m_M.IsEmpty() )
1143 return AsRad(
Poly( m_TT, { 84381.406, -46.836769, -0.0001831, 0.00200340, -0.000000576, -0.0000000434 } ) );
1156 InitEquinoxBasedParameters();
1157 return DPoint( m_dpsi, m_deps );
1320 return EquatorialToHorizontal( q.
x, q.
y );
1337 if ( !IsTopocentric() )
1340 if ( m_observer->cioBased )
1341 InitCIOBasedParameters();
1343 InitEquinoxBasedParameters();
1345 double sh, ch;
SinCos(
Norm2Pi( (m_observer->cioBased ? m_ERA : m_GAST) - ra +
Rad( m_observer->lambda ) ), sh, ch );
1346 double sd, cd;
SinCos( dec, sd, cd );
1348 ArcSin( sd*m_sphi + cd*ch*m_cphi ) );
1368 return Vector( q[0], q[1]*ce + q[2]*se, q[2]*ce - q[1]*se );
1385 double se, ce;
SinCos( eps, se, ce );
1386 return EquatorialToEcliptic( q, se, ce );
1424 double se, ce;
SinCos( eps, se, ce );
1425 return EquatorialToEcliptic( q, se, ce );
1445 return Vector( q[0], q[1]*ce - q[2]*se, q[2]*ce + q[1]*se );
1462 double se, ce;
SinCos( eps, se, ce );
1463 return EclipticToEquatorial( q, se, ce );
1501 double se, ce;
SinCos( eps, se, ce );
1502 return EclipticToEquatorial( q, se, ce );
1540 return Matrix( +0.494055821648, -0.054657353964, -0.445679169947,
1541 -0.872844082054, -0.484928636070, +0.746511167077,
1542 -0.867710446378, -0.198779490637, +0.455593344276 )*q;
1579 return Matrix( -0.823971452454, +1.289170419979, -2.918407488771,
1580 -2.840810442223, -1.835975400200, +0.229340705201,
1581 -2.808784424949, +1.654265575150, -3.263314653103 )*g;
1632 double m_gamb, m_phib, m_psib, m_epsa;
1634 double m_dpsi, m_deps;
1671 double m_sphi, m_cphi;
1674 bool m_isMoon =
false, m_isSun =
false, m_isStar =
false;
1678 bool m_usePolarMotion =
true;
1681 uint64 m_uniqueObjectId = 0;
1684 bool Validate(
const T& obj )
1686 if ( obj.m_uniqueId != m_uniqueObjectId )
1688 m_U0 = m_U = m_ub = m_u1 = m_u2 = m_u3e = m_u3i =
Vector();
1690 m_isMoon = m_isSun = m_isStar =
false;
1691 m_uniqueObjectId = obj.m_uniqueId;
1700 static double CIOLocator(
double T,
double X,
double Y );
1705 constexpr
static double au_km = 149597870.7;
1706 constexpr
static double c_km_s = 299792.458;
1707 constexpr
static double c_km_day = c_km_s*86400;
1708 constexpr
static double c_au_day = (c_km_s/au_km)*86400;
1709 constexpr
static double earth_omega = 7.292115e-5;
A smart pointer able to generate dynamically allocated copies of the objects pointed to by other smar...
Calculation of ephemerides from data stored in XEPH files.
Generic dynamic matrix of arbitrary dimensions.
A generic point in the two-dimensional space.
component x
Abscissa (horizontal, or X-axis coordinate).
component y
Ordinate (vertical, or Y-axis coordinate).
Generic vector of arbitrary length.
static GenericVector FromSpherical(double slon, double clon, double slat, double clat)
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
Reduction of planetary and stellar positions.
Vector HeliocentricPositionOfEarth() const
Optional< double > CometApparentVisualNuclearMagnitude(EphemerisFile::Handle &H)
static DPoint EquatorialToEcliptic(const DPoint &q, double eps)
bool CanComputeApparentVisualMagnitude(const EphemerisFile::Handle &H) const
static Vector EquatorialToEcliptic(const Vector &q, double se, double ce)
double LightTravelTime(EphemerisFile::Handle &H)
Position(Position &&)=default
Vector Astrometric(const StarPosition &S)
Matrix EquinoxBiasPrecessionNutationInverseMatrix()
Vector Geometric(EphemerisFile::Handle &H)
Vector Geometric(const StarPosition &S)
double TrueDistance(const StarPosition &S)
Vector True(EphemerisFile::Handle &H)
static Vector EclipticToEquatorial(const Vector &q, double se, double ce)
static DPoint GalacticToICRSEquatorial(const DPoint &g)
Vector Astrometric(EphemerisFile::Handle &H)
Vector Proper(EphemerisFile::Handle &H)
bool CanComputeCometApparentVisualTotalMagnitude(const EphemerisFile::Handle &H) const
DPoint EquatorialToHorizontal(double ra, double dec)
Vector Proper(const StarPosition &S)
Vector Intermediate(EphemerisFile::Handle &H)
double TrueDistance(EphemerisFile::Handle &H)
Position(const Position &)=default
Vector BarycentricPositionOfSun() const
void InitCIOBasedParameters()
Vector Apparent(const StarPosition &S)
static DPoint EclipticToEquatorial(const DPoint &q, double eps)
static DPoint EquatorialToEcliptic(const DPoint &q, double se, double ce)
static DPoint ICRSEquatorialToGalactic(const DPoint &q)
Optional< double > ApparentVisualMagnitude(EphemerisFile::Handle &H)
Position(TimePoint t, const IsoString ×cale="TT")
static DPoint EclipticToEquatorial(const DPoint &q, double se, double ce)
static Vector ICRSEquatorialToGalactic(const Vector &q)
Optional< double > CometApparentVisualTotalMagnitude(EphemerisFile::Handle &H)
Vector Intermediate(const StarPosition &S)
void InitEquinoxBasedParameters()
static Vector EclipticToEquatorial(const Vector &q, double eps)
void EnablePolarMotion(bool enable=true)
void DisablePolarMotion(bool disable=true)
double PhaseAngle(const StarPosition &S)
double PhaseAngle(EphemerisFile::Handle &H)
void SetObserver(const ObserverPosition &observer)
Vector BarycentricPositionOfEarth() const
ObserverPosition Observer() const
Vector Apparent(EphemerisFile::Handle &H)
Vector True(const StarPosition &S)
Matrix CIOBiasPrecessionNutationInverseMatrix()
static Vector GalacticToICRSEquatorial(const Vector &g)
bool CanComputeCometApparentVisualNuclearMagnitude(const EphemerisFile::Handle &H) const
DPoint EquatorialToHorizontal(const DPoint &q)
Matrix CIOBiasPrecessionNutationMatrix()
static Vector EquatorialToEcliptic(const Vector &q, double eps)
Vector BarycentricVelocityOfEarth() const
bool IsTopocentric() const
Matrix EquinoxBiasPrecessionNutationMatrix()
bool IsPolarMotionEnabled() const
An instant in any timescale.
64-bit floating point real vector.
void SinCos(T x, T &sx, T &cx) noexcept
constexpr T AsRad(T x) noexcept
constexpr T ArcTan(T x) noexcept
constexpr T Norm2Pi(T x) noexcept
constexpr T ArcSin(T x) noexcept
constexpr T Rad(T x) noexcept
T Poly(T x, C c, int n) noexcept
constexpr T Mod(T x, T y) noexcept
unsigned long long uint64
constexpr const T & Range(const T &x, const T &a, const T &b) noexcept
constexpr const T & Max(const T &a, const T &b) noexcept
Geodetic coordinates of a terrestrial observer.
ObserverPosition(ObserverPosition &&)=default
ObserverPosition()=default
ObserverPosition(const ObserverPosition &)=default
ObserverPosition(double longitude, double latitude, double height=0, double equatorialRadius=ea_eq_radius_IAU2009, double flattening=ea_flattening_IERS2010, const Vector ®ionalCenter=Vector(0, 0, 0), bool useCIO=false)
Positional data of a star.
double v
Radial velocity in km/s, positive away from Earth.
double muAlpha
Proper motion in right ascension, mas/year * cos( delta ).
TimePoint t0
Epoch of coordinates.
double delta
ICRS declination in degrees.
StarPosition(const StarPosition &x)
double muDelta
Proper motion in declination, in mas/year.
StarPosition(double ra, double dec, double properMotionRA=0, double properMotionDec=0, double parallax=0, double radialVelocity=0, TimePoint epoch=TimePoint::J2000())
double alpha
ICRS right ascension in degrees.
double p
Parallax in arcseconds.