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