From 8b93a984dd4cd02f03909d168e04f7a8e6581d4f Mon Sep 17 00:00:00 2001 From: VPRamon Date: Sat, 7 Mar 2026 21:37:46 +0100 Subject: [PATCH 1/7] feat: add Displacement class with operations and integration into Position --- include/siderust/coordinates/cartesian.hpp | 166 +++++++++++++++++++-- 1 file changed, 155 insertions(+), 11 deletions(-) diff --git a/include/siderust/coordinates/cartesian.hpp b/include/siderust/coordinates/cartesian.hpp index 86e0a58..7ee9133 100644 --- a/include/siderust/coordinates/cartesian.hpp +++ b/include/siderust/coordinates/cartesian.hpp @@ -110,6 +110,135 @@ template struct Direction { } }; +// Forward-declare Position for Displacement operators. +template struct Position; + +/** + * @brief A 3D Cartesian displacement (free vector), compile-time frame-tagged. + * + * Mirrors Rust's `affn::cartesian::Displacement`. + * + * Displacements are center-independent free vectors that represent the + * difference between two positions. Valid operations: + * - Displacement + Displacement -> Displacement + * - Displacement - Displacement -> Displacement + * - Position + Displacement -> Position + * - Position - Displacement -> Position + * - Position - Position -> Displacement + * + * @ingroup coordinates_cartesian + * @tparam F Reference frame tag (e.g. `frames::ICRS`). + * @tparam U Length unit (default: `qtty::Meter`). + */ +template struct Displacement { + static_assert(frames::is_frame_v, "F must be a valid frame tag"); + + U comp_x; ///< X component. + U comp_y; ///< Y component. + U comp_z; ///< Z component. + + Displacement() : comp_x(U(0)), comp_y(U(0)), comp_z(U(0)) {} + + Displacement(U x_, U y_, U z_) : comp_x(x_), comp_y(y_), comp_z(z_) {} + + Displacement(double x_, double y_, double z_) + : comp_x(U(x_)), comp_y(U(y_)), comp_z(U(z_)) {} + + U x() const { return comp_x; } + U y() const { return comp_y; } + U z() const { return comp_z; } + + /** + * @brief Magnitude of the displacement vector. + */ + U magnitude() const { + using std::sqrt; + const double vx = comp_x.value(); + const double vy = comp_y.value(); + const double vz = comp_z.value(); + return U(sqrt(vx * vx + vy * vy + vz * vz)); + } + + static constexpr siderust_frame_t frame_id() { + return frames::FrameTraits::ffi_id; + } + + /** + * @brief Add two displacements. + */ + Displacement operator+(const Displacement &other) const { + return Displacement(U(comp_x.value() + other.comp_x.value()), + U(comp_y.value() + other.comp_y.value()), + U(comp_z.value() + other.comp_z.value())); + } + + /** + * @brief Subtract two displacements. + */ + Displacement operator-(const Displacement &other) const { + return Displacement(U(comp_x.value() - other.comp_x.value()), + U(comp_y.value() - other.comp_y.value()), + U(comp_z.value() - other.comp_z.value())); + } + + /** + * @brief Negate a displacement. + */ + Displacement operator-() const { + return Displacement(U(-comp_x.value()), U(-comp_y.value()), + U(-comp_z.value())); + } + + /** + * @brief Scale a displacement by a scalar. + */ + Displacement operator*(double scalar) const { + return Displacement(U(comp_x.value() * scalar), U(comp_y.value() * scalar), + U(comp_z.value() * scalar)); + } + + /** + * @brief Transform this displacement to a different reference frame. + * + * @tparam Target Destination frame tag. + * @param jd Julian Date (TT) for time-dependent rotations. + */ + template + std::enable_if_t, + Displacement> + to_frame(const JulianDate &jd) const { + if constexpr (std::is_same_v) { + return Displacement(comp_x, comp_y, comp_z); + } else { + siderust_cartesian_pos_t out{}; + check_status(siderust_cartesian_dir_transform_frame( + comp_x.value(), comp_y.value(), comp_z.value(), + frames::FrameTraits::ffi_id, + frames::FrameTraits::ffi_id, jd.value(), &out), + "cartesian::Displacement::to_frame"); + return Displacement(out.x, out.y, out.z); + } + } +}; + +/** + * @brief Stream operator for Displacement. + */ +template +inline std::ostream &operator<<(std::ostream &os, + const Displacement &d) { + return os << d.x() << ", " << d.y() << ", " << d.z(); +} + +/** + * @brief Scale a displacement by a scalar (scalar on left). + */ +template +inline Displacement operator*(double scalar, + const Displacement &d) { + return d * scalar; +} + /** * @brief A 3D Cartesian position, compile-time tagged by center, frame, unit. * @@ -272,22 +401,37 @@ template struct Position { } /** - * @brief Subtract two positions in the same center/frame/unit (vector - * difference). + * @brief Subtract two positions in the same center/frame/unit. + * + * Returns a Displacement representing the vector from `other` to `this`. + * This is the only valid Position-Position operation in affine geometry. + */ + Displacement operator-(const Position &other) const { + return Displacement(U(comp_x.value() - other.comp_x.value()), + U(comp_y.value() - other.comp_y.value()), + U(comp_z.value() - other.comp_z.value())); + } + + /** + * @brief Translate a position by a displacement. + * + * Returns a new Position offset by the displacement vector. */ - Position operator-(const Position &other) const { - return Position(U(comp_x.value() - other.comp_x.value()), - U(comp_y.value() - other.comp_y.value()), - U(comp_z.value() - other.comp_z.value())); + Position operator+(const Displacement &displacement) const { + return Position(U(comp_x.value() + displacement.comp_x.value()), + U(comp_y.value() + displacement.comp_y.value()), + U(comp_z.value() + displacement.comp_z.value())); } /** - * @brief Add two positions in the same center/frame/unit (vector sum). + * @brief Translate a position backwards by a displacement. + * + * Returns a new Position offset by the negated displacement vector. */ - Position operator+(const Position &other) const { - return Position(U(comp_x.value() + other.comp_x.value()), - U(comp_y.value() + other.comp_y.value()), - U(comp_z.value() + other.comp_z.value())); + Position operator-(const Displacement &displacement) const { + return Position(U(comp_x.value() - displacement.comp_x.value()), + U(comp_y.value() - displacement.comp_y.value()), + U(comp_z.value() - displacement.comp_z.value())); } /** From 02945c7e619e53f1a0fc55c717212b14b6da84b6 Mon Sep 17 00:00:00 2001 From: VPRamon Date: Sun, 8 Mar 2026 03:30:10 +0100 Subject: [PATCH 2/7] update deps --- siderust | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/siderust b/siderust index cf65e9f..88ee34d 160000 --- a/siderust +++ b/siderust @@ -1 +1 @@ -Subproject commit cf65e9f733f43da4b3837f098fe8c9f0c08e0673 +Subproject commit 88ee34d1932d6236225ee01ff8bb83d13bb7b713 From 3f42574b45d75f24b0ac861dc41e9cb932fb9abb Mon Sep 17 00:00:00 2001 From: VPRamon Date: Sun, 8 Mar 2026 13:29:53 +0100 Subject: [PATCH 3/7] refactor: update submodule references and paths for tempoch-cpp integration --- .github/workflows/ci.yml | 6 ++---- .gitmodules | 3 --- CMakeLists.txt | 10 +++++----- Dockerfile | 2 +- README.md | 2 +- docs/Doxyfile.in | 2 +- qtty-cpp | 1 - run-ci.sh | 2 -- 8 files changed, 10 insertions(+), 18 deletions(-) delete mode 160000 qtty-cpp diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 493ffbd..55640c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -132,8 +132,8 @@ jobs: ~/.cargo/git siderust-ffi/target siderust-ffi/siderust/dev-deps/tempoch/tempoch-ffi/target - qtty-cpp/qtty/target - qtty-cpp/qtty/qtty-ffi/target + tempoch-cpp/qtty-cpp/qtty/target + tempoch-cpp/qtty-cpp/qtty/qtty-ffi/target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo- @@ -223,7 +223,6 @@ jobs: --root . \ --exclude 'build-coverage/.*' \ --exclude 'siderust/.*' \ - --exclude 'qtty-cpp/.*' \ --exclude 'tempoch-cpp/.*' \ --exclude 'tests/.*' \ --exclude 'examples/.*' \ @@ -239,7 +238,6 @@ jobs: --root . \ --exclude 'build-coverage/.*' \ --exclude 'siderust/.*' \ - --exclude 'qtty-cpp/.*' \ --exclude 'tempoch-cpp/.*' \ --exclude 'tests/.*' \ --exclude 'examples/.*' \ diff --git a/.gitmodules b/.gitmodules index b0aa42e..bf88722 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "qtty-cpp"] - path = qtty-cpp - url = git@github.com:VPRamon/qtty-cpp.git [submodule "tempoch-cpp"] path = tempoch-cpp url = git@github.com:Siderust/tempoch-cpp.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 34df5bb..b24407c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,16 +69,16 @@ add_dependencies(siderust_ffi build_siderust_ffi) # --------------------------------------------------------------------------- # Header-only C++ wrapper library # --------------------------------------------------------------------------- -# Pull in qtty-cpp (unit-safe quantities) as a subdirectory +# Pull in qtty-cpp (unit-safe quantities) via the nested tempoch-cpp checkout set(QTTY_FFI_FEATURES "" CACHE STRING "Cargo features for qtty-ffi" FORCE) -add_subdirectory(qtty-cpp) +add_subdirectory(tempoch-cpp/qtty-cpp) # Pull in tempoch-cpp (time types) as a subdirectory set(TEMPOCH_FFI_FEATURES "" CACHE STRING "Cargo features for tempoch-ffi" FORCE) add_subdirectory(tempoch-cpp) # Paths to qtty-ffi shared library (for RPATH) -set(QTTY_SUBMODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qtty-cpp/qtty) +set(QTTY_SUBMODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tempoch-cpp/qtty-cpp/qtty) set(QTTY_ARTIFACT_DIR ${QTTY_SUBMODULE_DIR}/target/release) # Paths to tempoch-ffi shared library (for RPATH) @@ -122,9 +122,9 @@ endif() # RPATH for shared library lookup at runtime if(APPLE) - set(_siderust_rpath "@loader_path/../siderust/siderust-ffi/target/release;@loader_path/../tempoch-cpp/tempoch/tempoch-ffi/target/release;@loader_path/../qtty-cpp/qtty/target/release") + set(_siderust_rpath "@loader_path/../siderust/siderust-ffi/target/release;@loader_path/../tempoch-cpp/tempoch/tempoch-ffi/target/release;@loader_path/../tempoch-cpp/qtty-cpp/qtty/target/release") elseif(UNIX) - set(_siderust_rpath "$ORIGIN/../siderust/siderust-ffi/target/release:$ORIGIN/../tempoch-cpp/tempoch/tempoch-ffi/target/release:$ORIGIN/../qtty-cpp/qtty/target/release") + set(_siderust_rpath "$ORIGIN/../siderust/siderust-ffi/target/release:$ORIGIN/../tempoch-cpp/tempoch/tempoch-ffi/target/release:$ORIGIN/../tempoch-cpp/qtty-cpp/qtty/target/release") endif() # --------------------------------------------------------------------------- diff --git a/Dockerfile b/Dockerfile index 5108edb..4af2466 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,7 @@ COPY . /workspace # Fail early if required submodules are missing from the build context. RUN test -f siderust/siderust-ffi/Cargo.toml && \ test -f tempoch-cpp/tempoch/tempoch-ffi/Cargo.toml && \ - test -f qtty-cpp/CMakeLists.txt + test -f tempoch-cpp/qtty-cpp/CMakeLists.txt # Validate the container toolchain by configuring, building, testing, and generating docs. RUN rm -rf build && \ diff --git a/README.md b/README.md index 92d7497..41f8477 100644 --- a/README.md +++ b/README.md @@ -173,7 +173,7 @@ siderust-cpp/ │ ├── test_altitude.cpp │ └── test_ephemeris.cpp ├── siderust-ffi/ ← git submodule (contains `siderust` as nested submodule) -└── qtty-cpp/ ← git submodule +└── tempoch-cpp/qtty-cpp/ ← nested git submodule ``` ## Architecture diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index 074f517..3c7669d 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -47,7 +47,7 @@ MACRO_EXPANSION = NO SKIP_FUNCTION_MACROS = YES INCLUDE_PATH = \ "@CMAKE_CURRENT_SOURCE_DIR@/include" \ - "@CMAKE_CURRENT_SOURCE_DIR@/qtty-cpp/include" \ + "@CMAKE_CURRENT_SOURCE_DIR@/tempoch-cpp/qtty-cpp/include" \ "@CMAKE_CURRENT_SOURCE_DIR@/siderust-ffi/include" \ "@CMAKE_CURRENT_SOURCE_DIR@/siderust-ffi/siderust/dev-deps/tempoch/tempoch-ffi/include" diff --git a/qtty-cpp b/qtty-cpp deleted file mode 160000 index a5821e1..0000000 --- a/qtty-cpp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a5821e14e6f5271998c5837b933abb9e281c8b77 diff --git a/run-ci.sh b/run-ci.sh index a986a36..3dbb69b 100755 --- a/run-ci.sh +++ b/run-ci.sh @@ -81,7 +81,6 @@ run_coverage() { --root . \ --exclude 'build-coverage/.*' \ --exclude 'siderust/.*' \ - --exclude 'qtty-cpp/.*' \ --exclude 'tempoch-cpp/.*' \ --exclude 'tests/.*' \ --exclude 'examples/.*' \ @@ -92,7 +91,6 @@ run_coverage() { --root . \ --exclude 'build-coverage/.*' \ --exclude 'siderust/.*' \ - --exclude 'qtty-cpp/.*' \ --exclude 'tempoch-cpp/.*' \ --exclude 'tests/.*' \ --exclude 'examples/.*' \ From 83483f3d47301889ab2a99ea5191991866b08d5c Mon Sep 17 00:00:00 2001 From: VPRamon Date: Sun, 8 Mar 2026 13:59:44 +0100 Subject: [PATCH 4/7] refactor: update submodule commit reference for tempoch-cpp --- tempoch-cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tempoch-cpp b/tempoch-cpp index 6ad1755..d6b83de 160000 --- a/tempoch-cpp +++ b/tempoch-cpp @@ -1 +1 @@ -Subproject commit 6ad1755dbe8111d4454517f0c915c93af6bc7961 +Subproject commit d6b83de6c7cc4a716f32bd7b2ccb8004dd2acb7e From 8f7bf5c8d512f1196b70f59f91ffaee7a18d414c Mon Sep 17 00:00:00 2001 From: VPRamon Date: Sun, 8 Mar 2026 14:25:48 +0100 Subject: [PATCH 5/7] refactor: update CI scripts and configurations for improved dependency tracking and coverage reporting --- .github/workflows/ci.yml | 13 ++++--- .gitignore | 3 +- examples/13_coordinate_operations.cpp | 43 +++++++++++----------- include/siderust/coordinates/cartesian.hpp | 11 +++--- include/siderust/coordinates/spherical.hpp | 10 ++--- include/siderust/ffi_core.hpp | 4 ++ run-ci.sh | 10 ++++- 7 files changed, 51 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55640c0..8a7924e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,8 +92,8 @@ jobs: set -euo pipefail git submodule status --recursive echo - echo "siderust-ffi: $(git -C siderust-ffi rev-parse HEAD) ($(git -C siderust-ffi describe --tags --always 2>/dev/null || true))" - echo "siderust: $(git -C siderust-ffi/siderust rev-parse HEAD) ($(git -C siderust-ffi/siderust describe --tags --always 2>/dev/null || true))" + echo "siderust-ffi: $(git -C siderust/siderust-ffi rev-parse HEAD) ($(git -C siderust/siderust-ffi describe --tags --always 2>/dev/null || true))" + echo "siderust: $(git -C siderust rev-parse HEAD) ($(git -C siderust describe --tags --always 2>/dev/null || true))" - name: Install system dependencies shell: bash @@ -130,8 +130,9 @@ jobs: path: | ~/.cargo/registry ~/.cargo/git - siderust-ffi/target - siderust-ffi/siderust/dev-deps/tempoch/tempoch-ffi/target + siderust/siderust-ffi/target + siderust/target + tempoch-cpp/tempoch/tempoch-ffi/target tempoch-cpp/qtty-cpp/qtty/target tempoch-cpp/qtty-cpp/qtty/qtty-ffi/target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} @@ -221,7 +222,7 @@ jobs: set -euo pipefail gcovr \ --root . \ - --exclude 'build-coverage/.*' \ + --exclude 'build-coverage[^/]*/.*' \ --exclude 'siderust/.*' \ --exclude 'tempoch-cpp/.*' \ --exclude 'tests/.*' \ @@ -236,7 +237,7 @@ jobs: mkdir -p coverage_html gcovr \ --root . \ - --exclude 'build-coverage/.*' \ + --exclude 'build-coverage[^/]*/.*' \ --exclude 'siderust/.*' \ --exclude 'tempoch-cpp/.*' \ --exclude 'tests/.*' \ diff --git a/.gitignore b/.gitignore index 0c80895..504392d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,7 @@ build/ cmake-build-*/ out/ build-* -coverage_html/ -coverage.xml +coverage* # IDE files .vscode/ diff --git a/examples/13_coordinate_operations.cpp b/examples/13_coordinate_operations.cpp index 37b6544..1a730f5 100644 --- a/examples/13_coordinate_operations.cpp +++ b/examples/13_coordinate_operations.cpp @@ -8,8 +8,9 @@ /// cartesian dot product, Euclidean 3D distance, and how type safety prevents /// accidentally mixing incompatible coordinate systems. /// -/// Build with: cmake --build build-local --target 13_coordinate_operations_example -/// Run with: ./build-local/13_coordinate_operations_example +/// Build with: cmake --build build-local --target +/// 13_coordinate_operations_example Run with: +/// ./build-local/13_coordinate_operations_example #include @@ -36,8 +37,8 @@ int main() { // Two well-known stars using EquatorialMeanJ2000 directions. // Constructor: Direction(azimuth, polar) = Direction(RA, Dec) spherical::direction::EquatorialMeanJ2000 polaris( - 37.9546_deg, // Right Ascension - 89.2641_deg // Declination + 37.9546_deg, // Right Ascension + 89.2641_deg // Declination ); spherical::direction::EquatorialMeanJ2000 sirius( 101.2872_deg, // Right Ascension @@ -62,8 +63,8 @@ int main() { // Self-separation must be exactly 0 auto self_sep = polaris.angular_separation(polaris); std::cout << std::setprecision(6); - std::cout << "Self-separation of Polaris = " << self_sep - << " (must be 0)" << std::endl + std::cout << "Self-separation of Polaris = " << self_sep << " (must be 0)" + << std::endl << std::endl; // ========================================================================= @@ -81,13 +82,14 @@ int main() { double angle_deg = angle_rad * 180.0 / M_PI; std::cout << std::setprecision(4); - std::cout << "Polaris cartesian: (" << polaris_cart.x << ", " << polaris_cart.y - << ", " << polaris_cart.z << ")" << std::endl; + std::cout << "Polaris cartesian: (" << polaris_cart.x << ", " + << polaris_cart.y << ", " << polaris_cart.z << ")" << std::endl; std::cout << "Sirius cartesian: (" << sirius_cart.x << ", " << sirius_cart.y << ", " << sirius_cart.z << ")" << std::endl; std::cout << std::setprecision(6); - std::cout << " angle_to (Cartesian) = " << angle_rad << " rad = " - << std::setprecision(4) << angle_deg << "\u00b0" << std::endl; + std::cout << " angle_to (Cartesian) = " << angle_rad + << " rad = " << std::setprecision(4) << angle_deg << "\u00b0" + << std::endl; std::cout << " angular_separation (Vincenty) = " << sep << std::endl; std::cout << std::scientific << std::setprecision(2); std::cout << " Difference = " @@ -110,8 +112,7 @@ int main() { std::cout << std::setprecision(6); std::cout << "dot(North Pole, Equatorial point) = " - << north_pole_c.dot(equatorial_c) - << " (must be 0)" << std::endl; + << north_pole_c.dot(equatorial_c) << " (must be 0)" << std::endl; // Anti-Polaris: opposite direction on the sky spherical::direction::EquatorialMeanJ2000 anti_polaris( @@ -119,15 +120,15 @@ int main() { qtty::Degree(-polaris.dec().value())); auto anti_polaris_c = anti_polaris.to_cartesian(); std::cout << "dot(Polaris, anti-Polaris) = " - << polaris_cart.dot(anti_polaris_c) - << " (must be -1)" << std::endl + << polaris_cart.dot(anti_polaris_c) << " (must be -1)" << std::endl << std::endl; // ========================================================================= // 4. Euclidean Distance Between Spherical Positions // ========================================================================= std::cout << "4. EUCLIDEAN DISTANCE BETWEEN SPHERICAL POSITIONS" << std::endl; - std::cout << "--------------------------------------------------" << std::endl; + std::cout << "--------------------------------------------------" + << std::endl; // Approximate heliocentric ecliptic positions (lon, lat, distance) spherical::position::EclipticMeanJ2000 earth( @@ -172,7 +173,7 @@ int main() { auto diff = mars_cart - earth_cart; std::cout << " Mars \u2212 Earth vector: (" << diff.x() << ", " << diff.y() << ", " << diff.z() << ")" << std::endl; - std::cout << " |Mars \u2212 Earth| = " << diff.distance() << std::endl + std::cout << " |Mars \u2212 Earth| = " << diff.magnitude() << std::endl << std::endl; // ========================================================================= @@ -194,12 +195,10 @@ int main() { << " (must be 90\u00b0)" << std::endl << std::endl; - std::cout - << " Type safety note: spherical::direction::EclipticMeanJ2000 and" - << std::endl; - std::cout - << " spherical::direction::EquatorialMeanJ2000 are distinct types." - << std::endl; + std::cout << " Type safety note: spherical::direction::EclipticMeanJ2000 and" + << std::endl; + std::cout << " spherical::direction::EquatorialMeanJ2000 are distinct types." + << std::endl; std::cout << " angular_separation only compiles within the same frame." << std::endl << std::endl; diff --git a/include/siderust/coordinates/cartesian.hpp b/include/siderust/coordinates/cartesian.hpp index 7ee9133..2600adb 100644 --- a/include/siderust/coordinates/cartesian.hpp +++ b/include/siderust/coordinates/cartesian.hpp @@ -70,8 +70,10 @@ template struct Direction { */ double angle_to(const Direction &other) const { double d = dot(other); - if (d > 1.0) d = 1.0; - if (d < -1.0) d = -1.0; + if (d > 1.0) + d = 1.0; + if (d < -1.0) + d = -1.0; return std::acos(d); } @@ -225,8 +227,7 @@ template struct Displacement { * @brief Stream operator for Displacement. */ template -inline std::ostream &operator<<(std::ostream &os, - const Displacement &d) { +inline std::ostream &operator<<(std::ostream &os, const Displacement &d) { return os << d.x() << ", " << d.y() << ", " << d.z(); } @@ -235,7 +236,7 @@ inline std::ostream &operator<<(std::ostream &os, */ template inline Displacement operator*(double scalar, - const Displacement &d) { + const Displacement &d) { return d * scalar; } diff --git a/include/siderust/coordinates/spherical.hpp b/include/siderust/coordinates/spherical.hpp index d5b333b..4a1ec97 100644 --- a/include/siderust/coordinates/spherical.hpp +++ b/include/siderust/coordinates/spherical.hpp @@ -161,13 +161,11 @@ template struct Direction { const double po1 = polar_.value() * DEG2RAD; const double az2 = other.azimuth_.value() * DEG2RAD; const double po2 = other.polar_.value() * DEG2RAD; - const double x = - std::cos(po1) * std::sin(po2) - - std::sin(po1) * std::cos(po2) * std::cos(az2 - az1); + const double x = std::cos(po1) * std::sin(po2) - + std::sin(po1) * std::cos(po2) * std::cos(az2 - az1); const double y = std::cos(po2) * std::sin(az2 - az1); - const double z = - std::sin(po1) * std::sin(po2) + - std::cos(po1) * std::cos(po2) * std::cos(az2 - az1); + const double z = std::sin(po1) * std::sin(po2) + + std::cos(po1) * std::cos(po2) * std::cos(az2 - az1); return qtty::Degree(std::atan2(std::sqrt(x * x + y * y), z) * RAD2DEG); } diff --git a/include/siderust/ffi_core.hpp b/include/siderust/ffi_core.hpp index 5202096..f104d6d 100644 --- a/include/siderust/ffi_core.hpp +++ b/include/siderust/ffi_core.hpp @@ -15,6 +15,10 @@ #include +#ifdef __cplusplus +using QttyQuantity = qtty_quantity_t; +#endif + extern "C" { #include "siderust_ffi.h" } diff --git a/run-ci.sh b/run-ci.sh index 3dbb69b..8570498 100755 --- a/run-ci.sh +++ b/run-ci.sh @@ -32,6 +32,12 @@ export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-2} cd /workspace +echo "==> Selected dependency revisions" +git submodule status --recursive +echo +echo "siderust-ffi: $(git -C siderust/siderust-ffi rev-parse HEAD) ($(git -C siderust/siderust-ffi describe --tags --always 2>/dev/null || true))" +echo "siderust: $(git -C siderust rev-parse HEAD) ($(git -C siderust describe --tags --always 2>/dev/null || true))" + run_lint() { echo "==> Lint: configure + clang-format + clang-tidy" rm -rf build @@ -79,7 +85,7 @@ run_coverage() { mkdir -p coverage_html gcovr \ --root . \ - --exclude 'build-coverage/.*' \ + --exclude 'build-coverage[^/]*/.*' \ --exclude 'siderust/.*' \ --exclude 'tempoch-cpp/.*' \ --exclude 'tests/.*' \ @@ -89,7 +95,7 @@ run_coverage() { gcovr \ --root . \ - --exclude 'build-coverage/.*' \ + --exclude 'build-coverage[^/]*/.*' \ --exclude 'siderust/.*' \ --exclude 'tempoch-cpp/.*' \ --exclude 'tests/.*' \ From 696833c94cf356b30c4a7426424ccb4f60efca23 Mon Sep 17 00:00:00 2001 From: VPRamon Date: Sun, 8 Mar 2026 14:50:37 +0100 Subject: [PATCH 6/7] refactor: update submodule commit reference for siderust --- siderust | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/siderust b/siderust index 88ee34d..27ef51a 160000 --- a/siderust +++ b/siderust @@ -1 +1 @@ -Subproject commit 88ee34d1932d6236225ee01ff8bb83d13bb7b713 +Subproject commit 27ef51aa56f3db8f3717a3cbdaba766b045b38d4 From 9460279ecfe6b4c9d34592f8e995cdd1b30c1126 Mon Sep 17 00:00:00 2001 From: VPRamon Date: Sun, 8 Mar 2026 15:16:03 +0100 Subject: [PATCH 7/7] refactor: update submodule commit reference for siderust --- siderust | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/siderust b/siderust index 27ef51a..41c0a72 160000 --- a/siderust +++ b/siderust @@ -1 +1 @@ -Subproject commit 27ef51aa56f3db8f3717a3cbdaba766b045b38d4 +Subproject commit 41c0a7253f872ec222082816e76ef0ad6c26fd5e