rust/landgen/src/outline_template_based/outline.rs
branchtransitional_engine
changeset 15956 c273908218f3
parent 15951 5f00829c55ec
child 16057 509ecce37522
--- 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);
                     }
                 }
             }