Class ostk::physics::Environment

class Environment

Environment modeling.

Public Functions

Environment(const Instant &anInstant, const Array<Shared<const Object>> &anObjectArray, const bool &setGlobalInstance = false)

Constructor.

Parameters:
  • anInstant -- [in] An instant

  • An -- [in] array of shared pointers to objects

  • setGlobalInstance -- [in] True if the global environment instance should be set

Environment(const Shared<const Object> &aCentralCelestialObject, const Array<Shared<const Object>> &anObjectArray, const Instant &anInstant = Instant::J2000(), const bool &setGlobalInstance = false)

Constructor.

Parameters:
  • aCentralCelestialObject -- [in] A central body

  • anObjectArray -- [in] An array of shared pointers to objects

  • anInstant -- [in] An instant. Defaults to J2000 epoch.

  • setGlobalInstance -- [in] True if the global environment instance should be set

bool isDefined() const

Check if environment is defined.

Returns:

True if environment is defined

bool hasObjectWithName(const String &aName) const

Returns true if environment contains objects with a given name.

Parameters:

aName -- [in] An object name

Returns:

True if environment contains objects with a given name

bool hasCentralCelestialObject() const

Has central celestial.

Returns:

True if environment has central celestial

bool intersects(const Object::Geometry &aGeometry, const Array<Shared<const Object>> &anObjectToIgnoreArray = Array<Shared<const Object>>::Empty()) const

Returns true if a given geometry intersects any of the environment objects.

Parameters:
  • aGeometry -- [in] A geometry

  • (optional) -- [in] anObjectToIgnoreArray An array of objects to ignore

Returns:

True if a given geometry intersects any of the environment objects

Array<Shared<const Object>> accessObjects() const

Access objects.

Returns:

Reference to array of shared pointers to objects

Shared<const Object> accessObjectWithName(const String &aName) const

Access object with a given name.

Parameters:

aName -- [in] An object name

Returns:

Reference to shared pointer to object

Shared<const Celestial> accessCelestialObjectWithName(const String &aName) const

Access celestial object with a given name.

Parameters:

aName -- [in] A celestial object name

Returns:

Reference to shared pointer to celestial object

Shared<const Celestial> accessCentralCelestialObject() const

Access central celestial.

Returns:

Shared pointer to central celestial

Instant getInstant() const

Get instant.

Returns:

Instant

Array<String> getObjectNames() const

Get names of objects.

Returns:

Array of objects names

void setInstant(const Instant &anInstant)

Set instant.

Parameters:

anInstant -- [in] An instant

bool isPositionInEclipse(const Position &aPosition) const

Is position in eclipse.

Parameters:

aPosition -- [in] A position

Returns:

True if the position is in eclipse

Public Static Functions

static Environment Undefined()

Get gravitational field at position.

Get magnetic field at position

Constructs an undefined environment

Environment environment = Environment::Undefined() ;
environment.isDefined() ; // False
Parameters:
  • aPosition -- [in] A position

  • aPosition -- [in] A position

Returns:

Gravitational field vector

Returns:

Magnetic field vector

Returns:

Undefined environment

static Environment Default(const bool &setGlobalInstance = false)

Constructs a default environment.

                Contains Earth, Sun and Moon, with SPICE-based ephemeris.

Environment environment = Environment::Default();

Parameters:

setGlobalInstance -- [in] True if the global environment instance should be set with the default

Returns:

Undefined environment

static void ResetGlobalInstance()

Reset the singleton instance of the environment to null.

static Shared<Environment> AccessGlobalInstance()

Get the singleton instance of the environment.

Returns:

Shared pointer to the singleton instance

static bool HasGlobalInstance()

Checks if the global instance is set.

Returns:

True if the global instance is set

Friends

friend std::ostream &operator<<(std::ostream &anOutputStream, const Environment &anEnvironment)

Output stream operator.

Parameters:
  • anOutputStream -- [in] An output stream

  • anEnvironment -- [in] An environment

Returns:

A reference to output stream