let s = (-s1.y * (p1.x - p3.x) + s1.x * (p1.y - p3.y)) / denomimator;
let t = ( s2.x * (p1.y - p3.y) - s2.y * (p1.x - p3.x)) / denomimator;
- if s >= 0.0 && s <= 1.0 && t >= 0.0 && t <= 1.0 {
+ if (0.0..=1.0).contains(&s) && (0.0..=1.0).contains(&t) {
return Intersection::Point(p1 + (s1 * t))
}
}
if d.y > 0 { 1 } else { -1 }
);
- let mut p = p1.clone();
+ let mut p = p1;
let mut points = vec!(point!(p.x as isize, p.y as isize));
let mut i = point!(0, 0);
while i.x < n.x || i.y < n.y {