1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
use crate::;
use HashSet;
use HashSet;
/// Computes a field of view around `coord` in a given `range`
///
/// This algorithm takes in account coordinates *visibility* through the
/// `blocking` argument. (*Blocking* coordinates should return `true`)
///
/// # Examples
///
/// - Compute field of view with no boundaries and some blocking tiles
///
/// ```rust
/// # use hexx::*;
/// # use std::collections::HashSet;
/// use hexx::algorithms::range_fov;
///
/// let pos = hex(0, 0);
/// let range = 10;
/// let blocking_coords: HashSet<Hex> = HashSet::new();
/// // Add blocking coordinates
/// // blocking_coords.insert(hex(2, 0));
/// // ..
/// let fov = range_fov(pos, range, |h| blocking_coords.contains(&h));
/// ```
/// Computes a field of view around `coord` in a given `range` towards
/// `direction` with 120 degrees vision
///
/// This algorithm takes in account coordinates *visibility* through the
/// `blocking` argument. (*Blocking* coordinates should return `true`)
///
/// # Examples
///
/// - Compute drectional field of view with no boundaries and some blocking
/// tiles
///
/// ```rust
/// # use hexx::*;
/// # use std::collections::HashSet;
/// use hexx::algorithms::directional_fov;
///
/// let pos = hex(0, 0);
/// let range = 10;
/// let dir = EdgeDirection::FLAT_TOP;
/// let blocking_coords: HashSet<Hex> = HashSet::new();
/// // Add blocking coordinates
/// // blocking_coords.insert(hex(2, 0));
/// // ..
/// let fov = directional_fov(pos, range, dir, |h| blocking_coords.contains(&h));
/// ```