Gravity Engine 12.0
Unity Asset for Gravity
Loading...
Searching...
No Matches
LunarCourseCorrection Class Reference

Classes

class  CorrectionData
 
class  ThreadAdapter
 

Public Member Functions

 LunarCourseCorrection (NBody spaceship, NBody moon)
 
double ClosestApproach (CorrectionData calcData)
 Perform Lunar closest approach and course correction calculations.
 
void ClosestApproachAsync (CorrectionData correctionData, CalcCallback calcCallback)
 
delegate void CalcCallback (LunarCourseCorrection lcc)
 
string CorrectionCalcAsync (double targetDistance, double targetAccuracy, double approachDistance, double maxTime, CalcCallback calcCallback)
 
bool CalculationUpdate ()
 Course correction calculations are Async on worker threads. In order to allow the rest of the game to run, the update runs as a state machine and should be polled periodically to check when the full correction calculation is done.
 
void GetCorrectionVelocity (ref double[] v)
 Get the corrected velocity for the lunar course correction.
 
void CalcCorrectionThread (object state)
 

Public Attributes

double targetDistance
 
double targetAccuracy
 
CorrectionData correctionFinal
 

Member Function Documentation

◆ CalculationUpdate()

bool LunarCourseCorrection.CalculationUpdate ( )

Course correction calculations are Async on worker threads. In order to allow the rest of the game to run, the update runs as a state machine and should be polled periodically to check when the full correction calculation is done.

A calculation is started with CalculationStart() and then this routine is polled until it returns true.

Results are retrieved with GetCorrection();

Returns

◆ ClosestApproach()

double LunarCourseCorrection.ClosestApproach ( CorrectionData  calcData)

Perform Lunar closest approach and course correction calculations.

ClosestApproach calculations can be done on the main thread or asynch with callback.

Course correction calculations can only be done async with a callback.

Note that the threading APIs assume that a specific Async call will complete before another one is started. If multiple parallel computations are required, instantiate additional copies of this class.

Parameters
targetDistance
Returns

◆ GetCorrectionVelocity()

void LunarCourseCorrection.GetCorrectionVelocity ( ref double[]  v)

Get the corrected velocity for the lunar course correction.

This routine should only be called from the correction done callback to ensure the computation has completed.

Parameters
v

The documentation for this class was generated from the following file: