rust/landgen/src/outline.rs
changeset 14132 95360f56db38
parent 14131 c416d32764b7
parent 14130 ab280be4b617
child 14133 a65b60f36b96
equal deleted inserted replaced
14131:c416d32764b7 14132:95360f56db38
    97                     (iy - ray.start.y) * ray.direction.cotangent() + ray.start.x
    97                     (iy - ray.start.y) * ray.direction.cotangent() + ray.start.x
    98                 } else {
    98                 } else {
    99                     (iy - edge.start.y) * edge_dir.cotangent() + edge.start.x
    99                     (iy - edge.start.y) * edge_dir.cotangent() + edge.start.x
   100                 };
   100                 };
   101 
   101 
   102                 let intersection_point = Point::new(ix, iy);
   102                 let intersection_point = Point::new(ix, iy).clamp(intersections_box);
   103                 let diff_point = ray.start - intersection_point;
   103                 let diff_point = ray.start - intersection_point;
   104                 let t = ray.direction.dot(diff_point);
   104                 let t = ray.direction.dot(diff_point);
       
   105 
   105                 if diff_point.max_norm() >= std::i16::MAX as i32 {
   106                 if diff_point.max_norm() >= std::i16::MAX as i32 {
   106                     Some((t, std::i32::MAX as u32))
   107                     Some((t, std::i32::MAX as u32))
   107                 } else {
   108                 } else {
   108                     let d = diff_point.integral_norm();
   109                     let d = diff_point.integral_norm();
   109 
   110