rust/landgen/src/outline.rs
changeset 14132 95360f56db38
parent 14131 c416d32764b7
parent 14130 ab280be4b617
child 14133 a65b60f36b96
--- a/rust/landgen/src/outline.rs	Mon Nov 05 19:53:26 2018 +0300
+++ b/rust/landgen/src/outline.rs	Mon Nov 05 19:56:28 2018 +0300
@@ -99,9 +99,10 @@
                     (iy - edge.start.y) * edge_dir.cotangent() + edge.start.x
                 };
 
-                let intersection_point = Point::new(ix, iy);
+                let intersection_point = Point::new(ix, iy).clamp(intersections_box);
                 let diff_point = ray.start - intersection_point;
                 let t = ray.direction.dot(diff_point);
+
                 if diff_point.max_norm() >= std::i16::MAX as i32 {
                     Some((t, std::i32::MAX as u32))
                 } else {