author | unc0rr |
Sat, 03 Nov 2018 00:02:03 +0100 | |
changeset 14124 | 8556937ae338 |
parent 14121 | 4d22be35cfa2 |
child 14142 | 69db1d2e4cec |
permissions | -rw-r--r-- |
14121 | 1 |
mod outline; |
14090 | 2 |
pub mod outline_template; |
14121 | 3 |
pub mod template_based; |
13929 | 4 |
|
13959
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13929
diff
changeset
|
5 |
extern crate integral_geometry; |
14121 | 6 |
extern crate itertools; |
14047 | 7 |
extern crate land2d; |
8 |
||
14048 | 9 |
pub struct LandGenerationParameters<T> { |
14047 | 10 |
zero: T, |
11 |
basic: T, |
|
14121 | 12 |
distance_divisor: u32, |
14047 | 13 |
} |
14 |
||
14121 | 15 |
impl<T: Copy + PartialEq> LandGenerationParameters<T> { |
14075
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
16 |
pub fn new(zero: T, basic: T) -> Self { |
14121 | 17 |
Self { |
18 |
zero, |
|
19 |
basic, |
|
20 |
distance_divisor: 1, |
|
21 |
} |
|
14075
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
22 |
} |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
23 |
} |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
24 |
|
14048 | 25 |
pub trait LandGenerator { |
14047 | 26 |
fn generate_land<T: Copy + PartialEq, I: Iterator<Item = u32>>( |
27 |
&self, |
|
28 |
parameters: LandGenerationParameters<T>, |
|
29 |
random_numbers: &mut I, |
|
30 |
) -> land2d::Land2D<T>; |
|
31 |
} |
|
13959
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13929
diff
changeset
|
32 |
|
13929 | 33 |
#[cfg(test)] |
34 |
mod tests { |
|
35 |
#[test] |
|
36 |
fn it_works() { |
|
37 |
assert_eq!(2 + 2, 4); |
|
38 |
} |
|
39 |
} |