Struct atm_refraction::Environment
source · pub struct Environment {
pub shape: EarthShape,
pub atmosphere: Atmosphere,
}
Expand description
Structure storing the shape of the underlying world and the atmospheric model.
Fields
shape: EarthShape
atmosphere: Atmosphere
Implementations
sourceimpl Environment
impl Environment
sourcepub fn n_minus_1(&self, h: f64) -> f64
pub fn n_minus_1(&self, h: f64) -> f64
Returns the refractive index of the air at the given altitude minus 1
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
-true
if the path should be a straight line,false
if 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
-true
if the path should be a straight line,false
if it should be a ray affected by the atmosphere
The ray is calculated by performing a binary search on the initial angle.
Trait Implementations
sourceimpl Clone for Environment
impl Clone for Environment
sourcefn clone(&self) -> Environment
fn clone(&self) -> Environment
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations
impl RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl UnwindSafe for Environment
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more