--- a/rust/landgen/src/outline_template_based/outline.rs Wed Feb 15 12:36:24 2023 +0100
+++ b/rust/landgen/src/outline_template_based/outline.rs Wed Feb 15 12:42:43 2023 +0100
@@ -180,16 +180,12 @@
// now go through all other segments
for s in self.segments_iter() {
- if s != segment {
- if intersects(&normal_ray, &s) {
- if let Some((t, d)) =
- solve_intersection(&self.intersections_box, &normal_ray, &s)
- {
- if t > 0 {
- dist_right = min(dist_right, d);
- } else {
- dist_left = min(dist_left, d);
- }
+ if s != segment && intersects(&normal_ray, &s) {
+ if let Some((t, d)) = solve_intersection(&self.intersections_box, &normal_ray, &s) {
+ if t > 0 {
+ dist_right = min(dist_right, d);
+ } else {
+ dist_left = min(dist_left, d);
}
}
}
@@ -197,32 +193,33 @@
// go through all points, including fill points
for pi in self.iter().cloned() {
- if pi != segment.start && pi != segment.end {
- if intersects(&pi.ray_with_dir(normal), &segment) {
- // ray from segment.start
- if let Some((t, d)) = solve_intersection(
- &self.intersections_box,
- &normal_ray,
- &segment.start.line_to(pi),
- ) {
- if t > 0 {
- dist_right = min(dist_right, d);
- } else {
- dist_left = min(dist_left, d);
- }
+ if pi != segment.start
+ && pi != segment.end
+ && intersects(&pi.ray_with_dir(normal), &segment)
+ {
+ // ray from segment.start
+ if let Some((t, d)) = solve_intersection(
+ &self.intersections_box,
+ &normal_ray,
+ &segment.start.line_to(pi),
+ ) {
+ if t > 0 {
+ dist_right = min(dist_right, d);
+ } else {
+ dist_left = min(dist_left, d);
}
+ }
- // ray from segment.end
- if let Some((t, d)) = solve_intersection(
- &self.intersections_box,
- &normal_ray,
- &segment.end.line_to(pi),
- ) {
- if t > 0 {
- dist_right = min(dist_right, d);
- } else {
- dist_left = min(dist_left, d);
- }
+ // ray from segment.end
+ if let Some((t, d)) = solve_intersection(
+ &self.intersections_box,
+ &normal_ray,
+ &segment.end.line_to(pi),
+ ) {
+ if t > 0 {
+ dist_right = min(dist_right, d);
+ } else {
+ dist_left = min(dist_left, d);
}
}
}
--- a/rust/landgen/src/wavefront_collapse/generator.rs Wed Feb 15 12:36:24 2023 +0100
+++ b/rust/landgen/src/wavefront_collapse/generator.rs Wed Feb 15 12:42:43 2023 +0100
@@ -123,13 +123,8 @@
(&tile_description.edges.left).into(),
];
- let tile = TileImage::<T, String>::new(
- tiles_image,
- top_edge,
- right_edge,
- bottom_edge,
- left_edge,
- );
+ let tile =
+ TileImage::<T, String>::new(tiles_image, top_edge, right_edge, bottom_edge, left_edge);
result.push(tile.clone());