author | alfadur |
Thu, 01 Nov 2018 03:38:13 +0300 | |
changeset 14054 | 3185fb34f3b5 |
parent 14051 | 8a0d69c16cad |
child 14069 | abb42ba345b6 |
permissions | -rw-r--r-- |
14054
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
1 |
pub mod template_based; |
13908 | 2 |
|
13938
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13908
diff
changeset
|
3 |
extern crate integral_geometry; |
14026 | 4 |
extern crate land2d; |
14051
8a0d69c16cad
Implement OutlinePoints for land generators, some ground work for template based landgen
unc0rr
parents:
14027
diff
changeset
|
5 |
extern crate itertools; |
14026 | 6 |
|
14027 | 7 |
pub struct LandGenerationParameters<T> { |
14026 | 8 |
zero: T, |
9 |
basic: T, |
|
10 |
} |
|
11 |
||
14054
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
12 |
impl <T: Copy + PartialEq> LandGenerationParameters<T> { |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
13 |
pub fn new(zero: T, basic: T) -> Self { |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
14 |
Self { zero, basic } |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
15 |
} |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
16 |
} |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
17 |
|
14027 | 18 |
pub trait LandGenerator { |
14026 | 19 |
fn generate_land<T: Copy + PartialEq, I: Iterator<Item = u32>>( |
20 |
&self, |
|
21 |
parameters: LandGenerationParameters<T>, |
|
22 |
random_numbers: &mut I, |
|
23 |
) -> land2d::Land2D<T>; |
|
24 |
} |
|
13938
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13908
diff
changeset
|
25 |
|
13908 | 26 |
#[cfg(test)] |
27 |
mod tests { |
|
28 |
#[test] |
|
29 |
fn it_works() { |
|
30 |
assert_eq!(2 + 2, 4); |
|
31 |
} |
|
32 |
} |