author | unc0rr |
Fri, 02 Nov 2018 22:59:22 +0100 | |
changeset 14100 | 4d22be35cfa2 |
parent 14069 | abb42ba345b6 |
child 14121 | 69db1d2e4cec |
permissions | -rw-r--r-- |
14100 | 1 |
mod outline; |
14069 | 2 |
pub mod outline_template; |
14100 | 3 |
pub mod template_based; |
13908 | 4 |
|
13938
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13908
diff
changeset
|
5 |
extern crate integral_geometry; |
14100 | 6 |
extern crate itertools; |
14026 | 7 |
extern crate land2d; |
8 |
||
14027 | 9 |
pub struct LandGenerationParameters<T> { |
14026 | 10 |
zero: T, |
11 |
basic: T, |
|
14100 | 12 |
distance_divisor: u32, |
14026 | 13 |
} |
14 |
||
14100 | 15 |
impl<T: Copy + PartialEq> LandGenerationParameters<T> { |
14054
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
16 |
pub fn new(zero: T, basic: T) -> Self { |
14100 | 17 |
Self { |
18 |
zero, |
|
19 |
basic, |
|
20 |
distance_divisor: 1, |
|
21 |
} |
|
14054
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
22 |
} |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
23 |
} |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
24 |
|
14027 | 25 |
pub trait LandGenerator { |
14026 | 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 |
} |
|
13938
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13908
diff
changeset
|
32 |
|
13908 | 33 |
#[cfg(test)] |
34 |
mod tests { |
|
35 |
#[test] |
|
36 |
fn it_works() { |
|
37 |
assert_eq!(2 + 2, 4); |
|
38 |
} |
|
39 |
} |