parry icon indicating copy to clipboard operation
parry copied to clipboard

`Segment::intersects_ray` returns false-positive when the segment is zero-length

Open picoHz opened this issue 3 years ago • 0 comments

use parry2d::math::*;
use parry2d::query::{Ray, RayCast};
use parry2d::shape::Segment;

fn main() {
    // never intersect each other
    let ray = Ray::new(Point::new(0.0, 0.0), Vector::new(1.0, 0.0));
    let segment = Segment {
        a: Point::new(10.0, 10.0),
        b: Point::new(10.0, 10.0),
    };

    // returns true
    let hit = segment.intersects_ray(&Isometry::identity(), &ray, std::f32::MAX);
    assert_eq!(hit, false);
}

picoHz avatar May 23 '21 02:05 picoHz