dimforge/parry

function hang infinitely

feyleth opened this issue · 2 comments

'traversal: while let Some(current) = next {
seen[*current] = true;
polyline_indices.push([prev as u32, *current as u32]);
for neighbor in index_adjacencies[*current].iter() {
if *neighbor != prev && *neighbor != first {
prev = *current;
next = Some(neighbor);
continue 'traversal;
} else if *neighbor != prev && *neighbor == first {
// If the next index is same as the first, close the polyline and exit
polyline_indices.push([*current as u32, first as u32]);
next = None;
continue 'traversal;
}

when none of condition it will hang infinitely

Do you happen to have an example trimesh ready to reproduce this ?

yes

use parry3d::{math::Point, na::Vector3, query::IntersectResult, shape::TriMesh};

fn main() {
    let points = vec![
        Point::from([0.0, 0.0, 0.0]),
        Point::from([0.0, 0.0, 1.0]),
        Point::from([1.0, 0.0, 0.0]),
        Point::from([1.0, 0.0, 1.0]),
    ];
    let indices = vec![[0, 1, 2], [1, 3, 2]];
    let trimesh = TriMesh::new(points, indices);
    let colid = trimesh.intersection_with_local_plane(&Vector3::<f32>::x_axis(), 0.5, 0.0005);
    match colid {
        IntersectResult::Intersect(points) => {
            println!("poliline {:#?}", points);
        }
        IntersectResult::Negative => {
            println!("positif");
        }
        IntersectResult::Positive => {
            println!("negatif");
        }
    }
}