Class ostk::physics::Environment¶
- class Environment¶
Environment modeling.
Public Functions
Constructor.
Environment env = Environment(Instant::J2000(), {});
- Parameters:
anInstant -- [in] An instant
An -- [in] array of shared pointers to objects
setGlobalInstance -- [in] True if the global environment instance should be set
- Throws:
RuntimeError -- if duplicate Celestial Objects with the same name are found
Constructor.
Environment env = Environment(earthSPtr, {earthSPtr, sunSPtr, moonSPtr});
- 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
- Throws:
RuntimeError -- if duplicate Celestial Objects with the same name are found
- bool isDefined() const¶
Check if environment is defined.
Environment env = Environment::Default(); env.isDefined(); // True
- Returns:
True if environment is defined
- bool hasObjectWithName(const String &aName) const¶
Returns true if environment contains objects with a given name.
Environment env = Environment::Default(); env.hasObjectWithName("Earth"); // True
- Parameters:
aName -- [in] An object name
- Returns:
True if environment contains objects with a given name
- bool hasCentralCelestialObject() const¶
Has central celestial.
Environment env = Environment::Default(); env.hasCentralCelestialObject(); // True
- Returns:
True if environment has central celestial
- bool isPositionInEclipse(const Position &aPosition, const bool &includePenumbra = true) const¶
Is position in eclipse.
Environment env = Environment::Default(); env.isPositionInEclipse(aPosition);
- Parameters:
aPosition -- [in] A position
includePenumbra -- [in] (optional) Whether to include penumbra in eclipse calculation. Defaults to true.
- Returns:
True if the position is in eclipse
- Array<Shared<const Object>> accessObjects() const¶
Access objects.
Environment env = Environment::Default(); Array<Shared<const Object>> objects = env.accessObjects();
- Returns:
Reference to array of shared pointers to objects
- Shared<const Object> accessObjectWithName(const String &aName) const¶
Access object with a given name.
Environment env = Environment::Default(); Shared<const Object> earth = env.accessObjectWithName("Earth");
- 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.
Environment env = Environment::Default(); Shared<const Celestial> earth = env.accessCelestialObjectWithName("Earth");
- Parameters:
aName -- [in] A celestial object name
- Returns:
Reference to shared pointer to celestial object
- Shared<const Celestial> accessCentralCelestialObject() const¶
Access central celestial.
Environment env = Environment::Default(); Shared<const Celestial> central = env.accessCentralCelestialObject();
- Returns:
Shared pointer to central celestial
- Instant getInstant() const¶
Get instant.
Environment env = Environment::Default(); Instant instant = env.getInstant();
- Returns:
Instant
- Array<String> getObjectNames() const¶
Get names of objects.
Environment env = Environment::Default(); Array<String> names = env.getObjectNames();
- Returns:
Array of objects names
- void setInstant(const Instant &anInstant)¶
Set instant.
Environment env = Environment::Default(); env.setInstant(Instant::Now());
- Parameters:
anInstant -- [in] An instant
Returns true if a given geometry intersects any of the environment objects.
Environment env = Environment::Default(); env.intersects(aGeometry);
- 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
Public Static Functions
- static Environment Undefined()¶
Constructs an undefined environment.
Environment environment = Environment::Undefined(); environment.isDefined(); // False
- 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.
Environment::ResetGlobalInstance();
- static Shared<Environment> AccessGlobalInstance()¶
Get the singleton instance of the environment.
Shared<Environment> env = Environment::AccessGlobalInstance();
- Returns:
Shared pointer to the singleton instance
- static bool HasGlobalInstance()¶
Checks if the global instance is set.
Environment::HasGlobalInstance(); // False
- 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