Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TriMesh.connected_components() gives multiple duplicate faces for quite simple meshes #115

Closed
wlinna opened this issue Jan 5, 2023 · 0 comments · Fixed by #120
Closed
Labels
bug Something isn't working

Comments

@wlinna
Copy link
Contributor

wlinna commented Jan 5, 2023

TriMeshConnectedComponents.face_groups data contains lots of duplicate values. Here's a minimalist test code to reproduce the problem.

    #[test]
    fn test_components_grouped_faces() {
        let verts = vec![
            // Originally face 126
            na::Point3::new(15.82, 6.455, -0.15),
            na::Point3::new(9.915, 6.455, -0.15),
            na::Point3::new(9.915, 6.4, 0.0),

            // Originally face 127
            na::Point3::new(15.82, 6.455, -0.15),
            na::Point3::new(9.915, 6.4, 0.0),
            na::Point3::new(15.82, 6.4, 0.0),
        ];

        let mut roof = TriMesh::new(
            verts,
            vec![[0, 1, 2], [3, 4, 5]],
        );

        if let Err(e) = roof.set_flags(TriMeshFlags::MERGE_DUPLICATE_VERTICES | TriMeshFlags::CONNECTED_COMPONENTS) {
            dbg!(e);
            assert!(false);
        }

        let components = roof.connected_components().unwrap();
        dbg!(components);
    }

Output:

[X] components = TriMeshConnectedComponents {
    face_colors: [0, 0,],
    grouped_faces: [0, 1, 1, 0, 0, ],
    ranges: [ 0, 5,],
}

I think the duplicates should be eliminated by parry. Otherwise downstream is forced to make sure their code works with duplicate faces.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants