-
-
Notifications
You must be signed in to change notification settings - Fork 129
Closed
Description
The following code started failing with the 0.22 release. It seems that polyline intersections are not detected reliably anymore.
use parry2d_f64::{
math::{Isometry, Point},
query::contact,
shape::Polyline,
};
fn main() {
// Large closed rectangle
let vertices = [
[-5.0, 20.0],
[-45.0, 20.0],
[-45.0, -20.0],
[-5.0, -20.0],
[-5.0, 20.0],
];
let line1 = Polyline::new(vertices.into_iter().map(Point::from).collect(), None);
// Small closed rectangle
let line2 = Polyline::new(
[
[-1.0, -1.0],
[4.0, -1.0],
[4.0, 1.0],
[-1.0, 1.0],
[-1.0, -1.0],
]
.into_iter()
.map(Point::from)
.collect(),
None,
);
let result = contact(
&Isometry::default(),
&line1,
// On the large rectangle
&Isometry::new([-25.0, -20.0].into(), -1.57),
&line2,
0.0,
);
// Fails since 0.22.0
assert!(result.is_ok_and(|c| c.is_some()));
}Metadata
Metadata
Assignees
Labels
No labels