author | unc0rr |
Sat, 03 Nov 2018 18:29:58 +0100 | |
changeset 14121 | 69db1d2e4cec |
parent 14100 | 4d22be35cfa2 |
child 14207 | bb2f301d4fe0 |
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, |
14121 | 13 |
skip_distort: bool, |
14 |
skip_bezier: bool, |
|
14026 | 15 |
} |
16 |
||
14100 | 17 |
impl<T: Copy + PartialEq> LandGenerationParameters<T> { |
14121 | 18 |
pub fn new(zero: T, basic: T, distance_divisor: u32, skip_distort: bool, skip_bezier: bool) -> Self { |
14100 | 19 |
Self { |
20 |
zero, |
|
21 |
basic, |
|
14121 | 22 |
distance_divisor, |
23 |
skip_distort, |
|
24 |
skip_bezier, |
|
14100 | 25 |
} |
14054
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
26 |
} |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
27 |
} |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
28 |
|
14027 | 29 |
pub trait LandGenerator { |
14026 | 30 |
fn generate_land<T: Copy + PartialEq, I: Iterator<Item = u32>>( |
31 |
&self, |
|
14121 | 32 |
parameters: &LandGenerationParameters<T>, |
14026 | 33 |
random_numbers: &mut I, |
34 |
) -> land2d::Land2D<T>; |
|
35 |
} |
|
13938
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13908
diff
changeset
|
36 |
|
13908 | 37 |
#[cfg(test)] |
38 |
mod tests { |
|
39 |
#[test] |
|
40 |
fn it_works() { |
|
41 |
assert_eq!(2 + 2, 4); |
|
42 |
} |
|
43 |
} |