approach.h#

Header file for close approach and impact detection.

Author

Rahil Makadia makadia2@illinois.edu

LICENSE#

Copyright (C) 2022-2025 Rahil Makadia

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, see https://www.gnu.org/licenses.

Functions

void check_ca_or_impact(PropSimulation *propSim, const real &tOld, const std::vector<real> xIntegOld, const real &t, const std::vector<real> xInteg)#

Check for a close approach or impact between two bodies.

Parameters:
  • propSim – [inout] PropSimulation object for the integration.

  • tOld – [in] Time at the previous integrator epoch.

  • xIntegOld – [in] State at the previous integrator epoch.

  • t – [in] Time at the current integrator epoch.

  • xInteg – [in] State at the current integrator epoch.

void ca_rdot_calc(PropSimulation *propSim, const size_t &i, const size_t &j, const real &t, real &rDot)#

Compute relative radial velocity to check for a close approach.

Parameters:
  • propSim – [in] PropSimulation object for the integration.

  • i – [in] Index of the first body.

  • j – [in] Index of the second body.

  • t – [in] Time at the current integrator epoch.

  • rDot – [out] Relative radial velocity.

void impact_r_calc(PropSimulation *propSim, const size_t &i, const size_t &j, const real &t, real &r)#

Compute relative distance to check for an impact.

Parameters:
  • propSim – [in] PropSimulation object for the integration.

  • i – [in] Index of the first body.

  • j – [in] Index of the second body.

  • t – [in] Time at the current integrator epoch.

  • r – [out] Relative distance.

std::vector<real> get_rel_state(PropSimulation *propSim, const size_t &i, const size_t &j, const real &t)#

Compute relative state of a body at a given time.

Parameters:
  • propSim – [in] PropSimulation object for the integration.

  • i – [in] Index of the first body.

  • j – [in] Index of the second body.

  • t – [in] Time to compute the relative state.

Returns:

xRel Relative state of the body.

void get_bplane_partials(PropSimulation *propSim, CloseApproachParameters *ca, const real &mu, const real &radius)#

Compute partials of B-plane parameters.

Parameters:
  • propSim – [in] PropSimulation object for the integration.

  • ca – [inout] CloseApproachParameters object for the close approach.

  • mu – [in] Gravitational parameter of the central body.

  • radius – [in] Radius of the central body.

void get_ca_or_impact_time(PropSimulation *propSim, const size_t &i, const size_t &j, const real &x1, const real &x2, real &tCA, void (*zero_func)(PropSimulation*, const size_t&, const size_t&, const real&, real&))#

Compute the time of close approach or impact using Brent’s method for root finding in a bracketed interval.

Parameters:
  • propSim – [in] PropSimulation object for the integration.

  • i – [in] Index of the first body.

  • j – [in] Index of the second body.

  • x1 – [in] Initial time of the bracketed interval.

  • x2 – [in] Final time of the bracketed interval.

  • tCA – [out] Time of close approach or impact.

  • zero_func – [in] Function to compute the zero of (rDot for CA or r for impacts).