FlightGear next
bodysolver.cxx File Reference
#include <cmath>
#include <ctime>
#include <cassert>
#include <simgear/math/SGMath.hxx>
#include <simgear/timing/sg_time.hxx>
#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
#include "bodysolver.hxx"

Go to the source code of this file.

Functions

void fgBodyPositionGST (double gst, double &lon, double &lat, bool sun_not_moon)
 given a particular time expressed in side real time at prime meridian (GST), compute position on the earth (lat, lon) such that solar system body is directly overhead.
 
static double body_angle (const SGTime &t, const SGVec3d &world_up, bool sun_not_moon)
 
time_t fgTimeSecondsUntilBodyAngle (time_t cur_time, const SGGeod &loc, double target_angle_deg, bool ascending, bool sun_not_moon)
 Given the current unix time in seconds, calculate seconds to the specified body angle (relative to straight up.) Also specify if we want the angle while the body is ascending or descending.
 

Variables

static const time_t day_secs = 86400
 
static const time_t half_day_secs = day_secs / 2
 
static const time_t step_secs = 60
 

Function Documentation

◆ body_angle()

static double body_angle ( const SGTime & t,
const SGVec3d & world_up,
bool sun_not_moon )
static

Definition at line 80 of file bodysolver.cxx.

◆ fgBodyPositionGST()

void fgBodyPositionGST ( double gst,
double & lon,
double & lat,
bool sun_not_moon )

given a particular time expressed in side real time at prime meridian (GST), compute position on the earth (lat, lon) such that solar system body is directly overhead.

(lat, lon are reported in radians)

Definition at line 53 of file bodysolver.cxx.

◆ fgTimeSecondsUntilBodyAngle()

time_t fgTimeSecondsUntilBodyAngle ( time_t cur_time,
const SGGeod & loc,
double target_angle_deg,
bool ascending,
bool sun_not_moon )

Given the current unix time in seconds, calculate seconds to the specified body angle (relative to straight up.) Also specify if we want the angle while the body is ascending or descending.

Given the current unix time in seconds, calculate seconds to the specified solar system body angle (relative to straight up.) Also specify if we want the angle while the body is ascending or descending.

For instance noon is when the sun angle is 0 (or the closest it can get.) Dusk is when the sun angle is 90 and descending. Dawn is when the sun angle is 90 and ascending.

Definition at line 123 of file bodysolver.cxx.

Variable Documentation

◆ day_secs

const time_t day_secs = 86400
static

Definition at line 44 of file bodysolver.cxx.

◆ half_day_secs

const time_t half_day_secs = day_secs / 2
static

Definition at line 45 of file bodysolver.cxx.

◆ step_secs

const time_t step_secs = 60
static

Definition at line 46 of file bodysolver.cxx.