...
This commit is contained in:
parent
0aa0113be3
commit
fd96dc395b
@ -5,7 +5,7 @@
|
||||
#include <mutex>
|
||||
|
||||
#include "mcc_ccte_iers.h"
|
||||
#include "mcc_coord.h"
|
||||
// #include "mcc_coord.h"
|
||||
#include "mcc_generics.h"
|
||||
|
||||
namespace mcc::ccte::erfa
|
||||
@ -310,36 +310,37 @@ public:
|
||||
return icrsTo(true, ra_icrs, dec_icrs, epoch, ra_obs, dec_obs, ha_obs, az, zd, obj_params);
|
||||
}
|
||||
|
||||
error_t icrsToObs(MccSkyRADEC_ICRS const& radec_icrs,
|
||||
MccSkyRADEC_OBS* radec_obs,
|
||||
MccSkyAZZD* azzd,
|
||||
mcc_angle_c auto* ha_obs,
|
||||
obj_pars_t* obj_params = nullptr)
|
||||
{
|
||||
double ra_obs, dec_obs, az, zd, ha;
|
||||
// error_t icrsToObs(MccSkyRADEC_ICRS const& radec_icrs,
|
||||
// MccSkyRADEC_OBS* radec_obs,
|
||||
// MccSkyAZZD* azzd,
|
||||
// mcc_angle_c auto* ha_obs,
|
||||
// obj_pars_t* obj_params = nullptr)
|
||||
// {
|
||||
// double ra_obs, dec_obs, az, zd, ha;
|
||||
|
||||
auto err =
|
||||
icrsToObs(radec_icrs.x(), radec_icrs.y(), radec_icrs.epoch(), &ra_obs, &dec_obs, &ha, &az, &zd, obj_params);
|
||||
// auto err =
|
||||
// icrsToObs(radec_icrs.x(), radec_icrs.y(), radec_icrs.epoch(), &ra_obs, &dec_obs, &ha, &az, &zd,
|
||||
// obj_params);
|
||||
|
||||
if (!err) {
|
||||
if (radec_obs) {
|
||||
radec_obs->setX(ra_obs);
|
||||
radec_obs->setY(dec_obs);
|
||||
}
|
||||
// if (!err) {
|
||||
// if (radec_obs) {
|
||||
// radec_obs->setX(ra_obs);
|
||||
// radec_obs->setY(dec_obs);
|
||||
// }
|
||||
|
||||
if (azzd) {
|
||||
azzd->setEpoch(radec_obs->epoch());
|
||||
azzd->setX(az);
|
||||
azzd->setY(zd);
|
||||
}
|
||||
// if (azzd) {
|
||||
// azzd->setEpoch(radec_obs->epoch());
|
||||
// azzd->setX(az);
|
||||
// azzd->setY(zd);
|
||||
// }
|
||||
|
||||
if (ha_obs) {
|
||||
*ha_obs = ha;
|
||||
}
|
||||
}
|
||||
// if (ha_obs) {
|
||||
// *ha_obs = ha;
|
||||
// }
|
||||
// }
|
||||
|
||||
return err;
|
||||
};
|
||||
// return err;
|
||||
// };
|
||||
|
||||
|
||||
// ICRS to apparent (in vacuo)
|
||||
@ -358,36 +359,37 @@ public:
|
||||
}
|
||||
|
||||
|
||||
error_t icrsToApp(MccSkyRADEC_ICRS const& radec_icrs,
|
||||
MccSkyRADEC_OBS* radec_app,
|
||||
MccSkyAZZD* azzd,
|
||||
mcc_angle_c auto* ha_app,
|
||||
obj_pars_t* obj_params = nullptr)
|
||||
{
|
||||
double ra_app, dec_app, az, zd, ha;
|
||||
// error_t icrsToApp(MccSkyRADEC_ICRS const& radec_icrs,
|
||||
// MccSkyRADEC_OBS* radec_app,
|
||||
// MccSkyAZZD* azzd,
|
||||
// mcc_angle_c auto* ha_app,
|
||||
// obj_pars_t* obj_params = nullptr)
|
||||
// {
|
||||
// double ra_app, dec_app, az, zd, ha;
|
||||
|
||||
auto err =
|
||||
icrsToApp(radec_icrs.x(), radec_icrs.y(), radec_icrs.epoch(), &ra_app, &dec_app, &ha, &az, &zd, obj_params);
|
||||
// auto err =
|
||||
// icrsToApp(radec_icrs.x(), radec_icrs.y(), radec_icrs.epoch(), &ra_app, &dec_app, &ha, &az, &zd,
|
||||
// obj_params);
|
||||
|
||||
if (!err) {
|
||||
if (radec_app) {
|
||||
radec_app->setX(ra_app);
|
||||
radec_app->setY(dec_app);
|
||||
}
|
||||
// if (!err) {
|
||||
// if (radec_app) {
|
||||
// radec_app->setX(ra_app);
|
||||
// radec_app->setY(dec_app);
|
||||
// }
|
||||
|
||||
if (azzd) {
|
||||
azzd->setEpoch(radec_app->epoch());
|
||||
azzd->setX(az);
|
||||
azzd->setY(zd);
|
||||
}
|
||||
// if (azzd) {
|
||||
// azzd->setEpoch(radec_app->epoch());
|
||||
// azzd->setX(az);
|
||||
// azzd->setY(zd);
|
||||
// }
|
||||
|
||||
if (ha_app) {
|
||||
*ha_app = ha;
|
||||
}
|
||||
}
|
||||
// if (ha_app) {
|
||||
// *ha_app = ha;
|
||||
// }
|
||||
// }
|
||||
|
||||
return err;
|
||||
}
|
||||
// return err;
|
||||
// }
|
||||
|
||||
|
||||
error_t obsToICRS(MccCoordPairKind obs_type,
|
||||
@ -401,22 +403,22 @@ public:
|
||||
}
|
||||
|
||||
|
||||
error_t obsToICRS(mcc_coord_pair_c auto const& xy_obs, MccSkyRADEC_ICRS* radec_icrs)
|
||||
{
|
||||
double ra, dec;
|
||||
// error_t obsToICRS(mcc_coord_pair_c auto const& xy_obs, MccSkyRADEC_ICRS* radec_icrs)
|
||||
// {
|
||||
// double ra, dec;
|
||||
|
||||
auto err = obsToICRS(xy_obs.pair_kind, xy_obs.epoch(), xy_obs.x(), xy_obs.y(), &ra, &dec);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
// auto err = obsToICRS(xy_obs.pair_kind, xy_obs.epoch(), xy_obs.x(), xy_obs.y(), &ra, &dec);
|
||||
// if (err) {
|
||||
// return err;
|
||||
// }
|
||||
|
||||
if (radec_icrs) {
|
||||
radec_icrs->setX(ra);
|
||||
radec_icrs->setY(dec);
|
||||
}
|
||||
// if (radec_icrs) {
|
||||
// radec_icrs->setX(ra);
|
||||
// radec_icrs->setY(dec);
|
||||
// }
|
||||
|
||||
return err;
|
||||
}
|
||||
// return err;
|
||||
// }
|
||||
|
||||
|
||||
error_t appToICRS(MccCoordPairKind app_type,
|
||||
@ -430,20 +432,20 @@ public:
|
||||
}
|
||||
|
||||
|
||||
error_t appToICRS(mcc_coord_pair_c auto const& xy_app, MccSkyRADEC_ICRS* radec_icrs)
|
||||
{
|
||||
double ra, dec;
|
||||
// error_t appToICRS(mcc_coord_pair_c auto const& xy_app, MccSkyRADEC_ICRS* radec_icrs)
|
||||
// {
|
||||
// double ra, dec;
|
||||
|
||||
auto err = appToICRS(xy_app.pair_kind, xy_app.epoch(), xy_app.x(), xy_app.y(), &ra, &dec);
|
||||
if (!err) {
|
||||
if (radec_icrs) {
|
||||
radec_icrs->setX(ra);
|
||||
radec_icrs->setY(dec);
|
||||
}
|
||||
}
|
||||
// auto err = appToICRS(xy_app.pair_kind, xy_app.epoch(), xy_app.x(), xy_app.y(), &ra, &dec);
|
||||
// if (!err) {
|
||||
// if (radec_icrs) {
|
||||
// radec_icrs->setX(ra);
|
||||
// radec_icrs->setY(dec);
|
||||
// }
|
||||
// }
|
||||
|
||||
return err;
|
||||
}
|
||||
// return err;
|
||||
// }
|
||||
|
||||
|
||||
error_t equationOrigins(mcc_coord_epoch_c auto const& epoch, mcc_angle_c auto* eo)
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "mcc_angle.h"
|
||||
#include "mcc_ccte_erfa_new.h"
|
||||
#include "mcc_defaults.h"
|
||||
#include "mcc_generics.h"
|
||||
|
||||
@ -182,10 +183,10 @@ struct MccSkyRADEC_APP : MccNamedCoordPair<MccAngleRA_APP, MccAngleDEC_APP> {
|
||||
using MccNamedCoordPair<MccAngleRA_APP, MccAngleDEC_APP>::MccNamedCoordPair;
|
||||
};
|
||||
|
||||
|
||||
struct MccSkyRADEC_OBS : MccNamedCoordPair<MccAngleRA_OBS, MccAngleDEC_OBS> {
|
||||
using MccNamedCoordPair<MccAngleRA_OBS, MccAngleDEC_OBS>::MccNamedCoordPair;
|
||||
};
|
||||
typedef MccNamedCoordPair<MccAngleRA_OBS, MccAngleDEC_OBS> MccSkyRADEC_OBS;
|
||||
// struct MccSkyRADEC_OBS : MccNamedCoordPair<MccAngleRA_OBS, MccAngleDEC_OBS> {
|
||||
// using MccNamedCoordPair<MccAngleRA_OBS, MccAngleDEC_OBS>::MccNamedCoordPair;
|
||||
// };
|
||||
|
||||
|
||||
struct MccSkyHADEC_APP : MccNamedCoordPair<MccAngleHA_APP, MccAngleDEC_APP> {
|
||||
@ -251,12 +252,6 @@ struct mcc_skypoint_interface_t {
|
||||
{
|
||||
return std::forward<SelfT>(self).operator PT();
|
||||
}
|
||||
|
||||
template <std::derived_from<mcc_skypoint_interface_t> SelfT, mcc_coord_pair_c PT, mcc_coord_pair_c... PTs>
|
||||
operator std::tuple<PT, PTs...>(this SelfT&& self)
|
||||
{
|
||||
return std::forward<SelfT>(self).operator std::tuple<PT, PTs...>();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@ -267,7 +262,7 @@ concept mcc_skypoint_c = std::derived_from<T, mcc_skypoint_interface_t> && requi
|
||||
|
||||
|
||||
|
||||
/* MCC-LIBRARY DEFAULT SKY POINT CLASS IMPLEMENTATION BASED ON ERFA-LIBRARY */
|
||||
/* MCC-LIBRARY DEFAULT GENERIC SKY POINT CLASS IMPLEMENTATION */
|
||||
|
||||
|
||||
template <typename CCTE_T>
|
||||
@ -325,7 +320,7 @@ public:
|
||||
|
||||
|
||||
template <mcc_coord_pair_c PT, mcc_coord_pair_c... PTs>
|
||||
auto to(PT& cpair, PTs&... cpairs)
|
||||
auto to(PT& cpair, PTs&... cpairs) const
|
||||
{
|
||||
toHelper(cpair);
|
||||
|
||||
@ -334,13 +329,23 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <mcc_coord_pair_c PT>
|
||||
operator PT()
|
||||
{
|
||||
PT res;
|
||||
to(res);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
protected:
|
||||
double _x{0.0}, _y{0.0};
|
||||
MccCoordPairKind _pairKind{MccCoordPairKind::COORDS_KIND_RADEC_ICRS};
|
||||
MccCelestialCoordEpoch _epoch{}; // J2000.0
|
||||
|
||||
template <mcc_coord_pair_c PT>
|
||||
auto toHelper(PT& cpair)
|
||||
auto toHelper(PT& cpair) const
|
||||
{
|
||||
static constexpr double half_pi = std::numbers::pi / 2.0;
|
||||
|
||||
@ -401,41 +406,11 @@ protected:
|
||||
static_assert(PT::pairKind != MccCoordPairKind::COORDS_KIND_UNKNOWN, "UNSUPPORTED SKY POINT TRANSFORMATION!");
|
||||
|
||||
|
||||
if (_pairKind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS) {
|
||||
if constexpr (PT::pairKind ==
|
||||
MccCoordPairKind::COORDS_KIND_RADEC_ICRS) { // from ICRS to ICRS - just copy and exit
|
||||
cpair = PT(typename PT::x_t(_x), typename PT::y_t(_y));
|
||||
if (_pairKind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS &&
|
||||
PT::pairKind == MccCoordPairKind::COORDS_KIND_RADEC_ICRS) { // from ICRS to ICRS - just copy and exit
|
||||
cpair = PT(typename PT::x_t(_x), typename PT::y_t(_y));
|
||||
|
||||
return;
|
||||
} else { // from ICRS to apparent or observed
|
||||
// if constexpr (mccIsAppCoordPairKind<PT::pairKind>) {
|
||||
// ccte_err = cctEngine.icrsToApp(_x, _y, cpair.epoch(), &ra, &dec, &ha, &az, &zd);
|
||||
// } else if constexpr (mccIsObsCoordPairKind<PT::pairKind>) {
|
||||
// ccte_err = cctEngine.icrsToObs(_x, _y, cpair.epoch(), &ra, &dec, &ha, &az, &zd);
|
||||
// } else {
|
||||
// static_assert(true, "UNSUPPORTED SKY POINT TRANSFORMATION!");
|
||||
// }
|
||||
|
||||
// if constexpr (PT::pairKind == MccCoordPairKind::COORDS_KIND_RADEC_APP ||
|
||||
// PT::pairKind == MccCoordPairKind::COORDS_KIND_RADEC_OBS) {
|
||||
// cpair.setX(ra);
|
||||
// cpair.setY(dec);
|
||||
// } else if constexpr (PT::pairKind == MccCoordPairKind::COORDS_KIND_HADEC_APP ||
|
||||
// PT::pairKind == MccCoordPairKind::COORDS_KIND_HADEC_OBS) {
|
||||
// cpair.setX(ha);
|
||||
// cpair.setY(dec);
|
||||
// } else if constexpr (PT::pairKind == MccCoordPairKind::COORDS_KIND_AZZD) {
|
||||
// cpair.setX(az);
|
||||
// cpair.setY(zd);
|
||||
// } else if constexpr (PT::pairKind == MccCoordPairKind::COORDS_KIND_AZALT) {
|
||||
// cpair.setX(az);
|
||||
// cpair.setY(half_pi - zd);
|
||||
// } else {
|
||||
// static_assert(true, "UNSUPPORTED SKY POINT TRANSFORMATION!");
|
||||
// }
|
||||
|
||||
// return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// just copy coordinates and exit
|
||||
@ -636,4 +611,9 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* MCC-LIBRARY DEFAULT SKY POINT CLASS WITH ERFA-LIBRARY BASED ENGINE */
|
||||
|
||||
typedef MccGenericSkyPoint<ccte::erfa::MccCCTE_ERFA> MccSkyPoint;
|
||||
|
||||
} // end namespace mcc
|
||||
|
||||
@ -23,7 +23,7 @@ int main()
|
||||
skypt_t::cctEngine.setStateERFA(saoras);
|
||||
|
||||
skypt_t pt;
|
||||
MccSkyRADEC_ICRS icrs(0.0, 30.0_degs);
|
||||
MccSkyRADEC_ICRS icrs(0.0, 70.0_degs);
|
||||
|
||||
pt = icrs;
|
||||
|
||||
@ -55,6 +55,11 @@ int main()
|
||||
|
||||
|
||||
// radec_obs = {10.2387983_degs, "43:21:34.5465"_dms};
|
||||
icrs.setX(111.0_degs), icrs.setY(111.0_degs);
|
||||
azzd.setX(111.0_degs), azzd.setY(111.0_degs);
|
||||
azalt.setX(111.0_degs), azalt.setY(111.0_degs);
|
||||
hadec_obs.setX(111.0_degs), hadec_obs.setY(111.0_degs);
|
||||
|
||||
pt = radec_obs;
|
||||
pt.to(icrs, azzd, hadec_obs);
|
||||
|
||||
@ -73,5 +78,8 @@ int main()
|
||||
std::cout << "AZ = " << azzd.x().sexagesimal() << "\n";
|
||||
std::cout << "ZD = " << azzd.y().sexagesimal() << "\n";
|
||||
|
||||
azalt = pt;
|
||||
std::cout << "ALT = " << azalt.y().sexagesimal() << "\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user