siderust-cpp 0.8.0
Header-only C++ wrapper for siderust
Loading...
Searching...
No Matches
lambert.hpp File Reference

Lambert solver C++ wrapper. More...

#include "ffi_core.hpp"
#include <array>
#include <cstdint>
#include <ostream>
Include dependency graph for lambert.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  siderust::lambert::Diagnostics
 Householder-iteration diagnostics accompanying a Lambert solution. More...
 
struct  siderust::lambert::Solution
 Complete solution to a Lambert boundary-value problem. More...
 

Namespaces

namespace  siderust
 
namespace  siderust::lambert
 
namespace  siderust::lambert::detail
 

Enumerations

enum class  siderust::lambert::Branch : int { siderust::lambert::Prograde = 0 , siderust::lambert::Retrograde = 1 }
 Branch selector for the Lambert solver. More...
 

Functions

Solution siderust::lambert::detail::solve_impl (const double *r1_km, const double *r2_km, double tof_s, double mu_km3_s2, Branch branch)
 
Solution siderust::lambert::solve (const double(&r1_km)[3], const double(&r2_km)[3], double tof_s, double mu_km3_s2, Branch branch=Branch::Prograde)
 Solve Lambert's single-revolution two-point boundary-value problem.
 
Solution siderust::lambert::solve (const std::array< double, 3 > &r1_km, const std::array< double, 3 > &r2_km, double tof_s, double mu_km3_s2, Branch branch=Branch::Prograde)
 Overload accepting std::array<double,3> positions.
 
std::ostream & siderust::lambert::operator<< (std::ostream &os, const Solution &sol)
 Stream a Lambert solution (velocities in km/s).
 

Detailed Description

Lambert solver C++ wrapper.

Wraps siderust_lambert_solve (Izzo's algorithm) with a value-semantic C++17 interface. All inputs/outputs use plain double arrays — no heavy unit types cross the FFI; callers can wrap results in qtty types as desired.

Typical usage

double r1[3] = { 1.496e8, 0.0, 0.0 }; // Earth position, km
double r2[3] = { 1.978e8, 1.142e8, 0.0 }; // Mars position, km
auto sol = siderust::lambert::solve(r1, r2, 258.0 * 86400.0, 1.327e11);
// sol.v1_kms — departure velocity in km/s
// sol.v2_kms — arrival velocity in km/s
Lambert solver C++ wrapper.
Solution solve(const double(&r1_km)[3], const double(&r2_km)[3], double tof_s, double mu_km3_s2, Branch branch=Branch::Prograde)
Solve Lambert's single-revolution two-point boundary-value problem.
Definition lambert.hpp:84

Definition in file lambert.hpp.