When using segments_intersection2d, I get misleading results. Instead of first_loc1 being OnVertex(0), I get OnEdge([1.0, 0.0]). While they represent the same point, the result is misleading since the doc comment of OnEdge says
The point lies on the segment interior., and OnVertex would be more precise. One should also note that OnEdge([1.0, 0.0]) != OnVertex(0).
When I run the following code:
use rapier2d::prelude::*;
let seg1 = Segment::new(point![10.0, 0.0], point![10.0, 10.0]);
let seg2 = Segment::new(point![10.0, 0.0], point![10.0, 10.0]);
let intersection = rapier2d::parry::utils::segments_intersection2d(&seg1.a, &seg1.b, &seg2.a, &seg2.b, 0.0).unwrap();
let rapier2d::parry::utils::SegmentsIntersection::Segment { first_loc1, first_loc2, second_loc1, second_loc2 } = intersection else {
unreachable!("The intersection should be a Segment intersection!");
};
dbg!(first_loc1);
dbg!(first_loc2);
dbg!(second_loc1);
dbg!(second_loc2);
When using
segments_intersection2d
, I get misleading results. Instead offirst_loc1
beingOnVertex(0)
, I getOnEdge([1.0, 0.0])
. While they represent the same point, the result is misleading since the doc comment of OnEdge saysThe point lies on the segment interior.
, andOnVertex
would be more precise. One should also note thatOnEdge([1.0, 0.0]) != OnVertex(0)
.When I run the following code:
The output is
The output should be:
rustc: 1.65 parry2d: tested on 0.10 and 0.11.1