diff --git a/src/math.rs b/src/math.rs index 718bddb..2a5cbfe 100644 --- a/src/math.rs +++ b/src/math.rs @@ -194,10 +194,12 @@ pub fn intersect_circle_segment(circle: &Circle, segment: &Line) -> Vec { pub fn between_vectors(p: Point, from: Point, to: Point) -> bool { let cross = cross_product(from, to); - if cross >= 0. { - cross_product(from, p) >= 0. && cross_product(p, to) >= 0. + if cross > 0.0 { + cross_product(from, p) >= 0.0 && cross_product(p, to) >= 0.0 + } else if cross < 0.0 { + cross_product(from, p) >= 0.0 || cross_product(p, to) >= 0.0 } else { - cross_product(from, p) >= 0. || cross_product(p, to) >= 0. + false } } diff --git a/src/shape.rs b/src/shape.rs index 313889e..2982cdf 100644 --- a/src/shape.rs +++ b/src/shape.rs @@ -136,7 +136,7 @@ impl Shape { Shape::Dot(..) => unreachable!(), Shape::Seg(other) => seg.polygon().intersects(&other.polygon()), Shape::Bend(other) => { - /*for segment in seg.polygon().exterior().lines() { + for segment in seg.polygon().exterior().lines() { let inner_circle = other.inner_circle(); let outer_circle = other.outer_circle(); @@ -151,7 +151,7 @@ impl Shape { return true; } } - }*/ + } false }