author | alfadur |
Sun, 22 Jan 2023 03:53:09 +0300 | |
changeset 15939 | 9cdc61bc6535 |
parent 15850 | 44b49f255e31 |
child 15932 | 230dc46487ea |
permissions | -rw-r--r-- |
14121 | 1 |
mod outline; |
14090 | 2 |
pub mod outline_template; |
14121 | 3 |
pub mod template_based; |
13929 | 4 |
|
14048 | 5 |
pub struct LandGenerationParameters<T> { |
14047 | 6 |
zero: T, |
7 |
basic: T, |
|
14121 | 8 |
distance_divisor: u32, |
14142 | 9 |
skip_distort: bool, |
10 |
skip_bezier: bool, |
|
14047 | 11 |
} |
12 |
||
14121 | 13 |
impl<T: Copy + PartialEq> LandGenerationParameters<T> { |
15850 | 14 |
pub fn new( |
15 |
zero: T, |
|
16 |
basic: T, |
|
17 |
distance_divisor: u32, |
|
18 |
skip_distort: bool, |
|
19 |
skip_bezier: bool, |
|
20 |
) -> Self { |
|
14121 | 21 |
Self { |
22 |
zero, |
|
23 |
basic, |
|
14142 | 24 |
distance_divisor, |
25 |
skip_distort, |
|
26 |
skip_bezier, |
|
14121 | 27 |
} |
14075
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
28 |
} |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
29 |
} |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
30 |
|
14048 | 31 |
pub trait LandGenerator { |
14047 | 32 |
fn generate_land<T: Copy + PartialEq, I: Iterator<Item = u32>>( |
33 |
&self, |
|
14142 | 34 |
parameters: &LandGenerationParameters<T>, |
14047 | 35 |
random_numbers: &mut I, |
36 |
) -> land2d::Land2D<T>; |
|
37 |
} |
|
13959
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13929
diff
changeset
|
38 |
|
13929 | 39 |
#[cfg(test)] |
40 |
mod tests { |
|
41 |
#[test] |
|
42 |
fn it_works() { |
|
43 |
assert_eq!(2 + 2, 4); |
|
44 |
} |
|
45 |
} |