y: self.y as i32,
}
}
+
+ pub fn cross_product(&self, p: Self) -> f64 {
+ return self.x * p.y - self.y * p.x;
+ }
}
macro_rules! impl_point_op {
pub fn supercover_line_int(p1: Point<isize>, p2: Point<isize>) -> Vec<Point<isize>> {
let d = p2 - p1;
let n = point!(d.x.abs(), d.y.abs());
- let step = point!(
- if d.x > 0 { 1 } else { -1 },
- if d.y > 0 { 1 } else { -1 }
- );
+ let step = point!(d.x.signum(), d.y.signum());
let mut p = p1;
let mut points = vec!(point!(p.x as isize, p.y as isize));