dimforge/parry

`TriMesh.connected_components()` gives meaningless `face_colors` for quite simple meshes

wlinna opened this issue · 1 comments

Face color computation doesn't seem to work. In my simple test case, all the values were equal to u32::MAX.

    let verts = vec![
        // Tri 1
        na::Point3::new(0.0, 0.0, 0.0),
        na::Point3::new(10.0, 0.0, 0.0),
        na::Point3::new(10.0, 0.0, 10.0),
        // Tri 2
        na::Point3::new(0.0, 1.0, 0.0),
        na::Point3::new(10.0, 1.0, 0.0),
        na::Point3::new(10.0, 1.0, -1.0)
    ];

    let trimesh = TriMesh::with_flags(
        verts,
        vec![[0, 1, 2], [3, 4, 5]],
        TriMeshFlags::CONNECTED_COMPONENTS
    );

    let components = trimesh.connected_components().unwrap();

    dbg!(components);

    assert!(components.face_colors.iter().all(|v| *v != u32::MAX)); // Fails! All of the values are equal to u32::MAX

Here's the output of dbg!(components)

[src/main.rs:24] components = TriMeshConnectedComponents {
    face_colors: [
        4294967295,
        4294967295,
    ],
    grouped_faces: [
        0,
        1,
    ],
    ranges: [
        0,
        1,
        2,
    ],
}

I noticed this first on parry3d 0.10.0, but it appears with parry3d 0.11.1 as well.
rustc: 1.65.0

wlinna commented

I tested this on parry3d 0.14, and the bug is gone.