pub struct Environment {
pub shape: EarthShape,
pub atmosphere: Atmosphere,
pub wavelength: f64,
}Expand description
Structure storing the shape of the underlying world and the atmospheric model.
Fields§
§shape: EarthShape§atmosphere: Atmosphere§wavelength: f64Implementations§
Source§impl Environment
impl Environment
Sourcepub fn dn(&self, h: f64) -> f64
pub fn dn(&self, h: f64) -> f64
Returns the derivative of the refractive index of the air with respect to the altitude, at the given altitude
Sourcepub fn radius(&self) -> Option<f64>
pub fn radius(&self) -> Option<f64>
Returns Some(radius in meters) if the planet model is spherical, or None if it’s flat.
Sourcepub fn cast_ray<'a>(
&'a self,
start_h: f64,
start_ang: f64,
straight: bool,
) -> Box<dyn Path<'a> + 'a>
pub fn cast_ray<'a>( &'a self, start_h: f64, start_ang: f64, straight: bool, ) -> Box<dyn Path<'a> + 'a>
Returns an object representing a light path.
The path is defined by 3 parameters:
start_h- the starting altitude of the path in metersstart_ang- the initial angle in radians between the path and the horizontal plane; -π/2 is down, 0 is horizontal, π/2 is upstraight-trueif the path should be a straight line,falseif it should be a ray affected by the atmosphere
Sourcepub fn cast_ray_stepper<'a>(
&'a self,
start_h: f64,
start_ang: f64,
straight: bool,
) -> Box<dyn PathStepper<Item = RayState> + 'a>
pub fn cast_ray_stepper<'a>( &'a self, start_h: f64, start_ang: f64, straight: bool, ) -> Box<dyn PathStepper<Item = RayState> + 'a>
Returns an object representing a light path.
The path is defined by 3 parameters:
start_h- the starting altitude of the path in metersstart_ang- the initial angle in radians between the path and the horizontal plane; -π/2 is down, 0 is horizontal, π/2 is upstraight-trueif the path should be a straight line,falseif it should be a ray affected by the atmosphere
Sourcepub fn cast_ray_target<'a>(
&'a self,
start_h: f64,
tgt_h: f64,
tgt_dist: f64,
straight: bool,
) -> Box<dyn Path<'a> + 'a>
pub fn cast_ray_target<'a>( &'a self, start_h: f64, tgt_h: f64, tgt_dist: f64, straight: bool, ) -> Box<dyn Path<'a> + 'a>
Returns an object representing a light path.
Instead of using the initial angle, this method chooses a ray that will hit a given target. The target is defined as distance and altitude.
start_h- the initial altitude of the path in meterstgt_h- the altitude of the target point in meterstgt_dist- the distance of the target point from the initial point, in metersstraight-trueif the path should be a straight line,falseif it should be a ray affected by the atmosphere
The ray is calculated by performing a binary search on the initial angle.
Trait Implementations§
Source§impl Clone for Environment
impl Clone for Environment
Source§fn clone(&self) -> Environment
fn clone(&self) -> Environment
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Environment
impl RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl UnwindSafe for Environment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more