pub fn compute_fov<F, G>(origin: Pos, is_blocking: &mut F, mark_visible: &mut G)
    where F: FnMut(Pos) -> bool,
          G: FnMut(Pos), {

    mark_visible(origin);

    for i in 0..4 {
        let quadrant = Quadrant::new(Cardinal::from_index(i), origin);

        let first_row = Row::new(1, Rational::new(-1, 1), Rational::new(1, 1));

        scan(first_row, quadrant, is_blocking, mark_visible);
    }
}
/// Compute FOV information for a given position using the shadow mapping algorithm.
///
/// This uses the is_blocking closure, which checks whether a given position is
/// blocked (such as by a wall), and is expected to capture some kind of grid
/// or map from the user.
///
/// The mark_visible closure provides the ability to collect visible tiles. This
/// may push them to a vector (captured in the closure's environment), or
/// modify a cloned version of the map.
///
///
/// I tried to write a nicer API which would modify the map as a separate user
/// data, but I can't work out the lifetime annotations.

Compute FOV information for a given position using the shadow mapping algorithm.
This uses the is_blocking closure, which checks whether a given position is
blocked (such as by a wall), and is expected to capture some kind of grid
or map from the user.

The mark_visible closure provides the ability to collect visible tiles. This
may push them to a vector (captured in the closure's environment), or
modify a cloned version of the map.

I tried to write a nicer API which would modify the map as a separate user
data, but I can't work out the lifetime annotations.
Compute FOV information for a given position using the shadow mapping algorithm . This uses the is_blocking closure which checks whether a given position is blocked ( such as by a wall ) and is expected to capture some kind of grid or map from the user . The mark_visible closure provides the ability to collect visible tiles . This may push them to a vector ( captured in the closure ' s environment ) or modify a cloned version of the map . I tried to write a nicer API which would modify the map as a separate user data but I can ' t work out the lifetime annotations .
pub fn compute_fov<F, G>(origin: Pos, is_blocking: &mut F, mark_visible: &mut G)
    where F: FnMut(Pos) -> bool,
          G: FnMut(Pos), {
    mark_visible(origin);
    for i in 0..4 {
        let quadrant = Quadrant::new(Cardinal::from_index(i), origin);
        let first_row = Row::new(1, Rational::new(-1, 1), Rational::new(1, 1));
        scan(first_row, quadrant, is_blocking, mark_visible);
    }
}
pub fn compute_fov < F , G > ( origin : Pos , is_blocking : & mut F , mark_visible : & mut G ) where F : FnMut ( Pos ) -> bool , G : FnMut ( Pos ) , { mark_visible ( origin ) ; for i in 0 .. 4 { let quadrant = Quadrant :: new ( Cardinal :: from_index ( i ) , origin ) ; let first_row = Row :: new ( 1 , Rational :: new ( - 1 , 1 ) , Rational :: new ( 1 , 1 ) ) ; scan ( first_row , quadrant , is_blocking , mark_visible ) ; } }
Compute FOV information for a given position using the shadow mapping algorithm.
Compute FOV information for a given position using the shadow mapping algorithm .
origin
Pos
is_blocking
&mut F
mark_visible
&mut G