dimforge / dimforge/parry

Convex hull produces invalid topology

Open
#311 4 comments 0 reactions 0 assignees View on GitHub
C-Bug D-Medium P-Critical
Dominant language
Rust
Stars
867
Forks
157
Avg merge
7d 13h
Merged PRs (30d)
2

Description

Hi there,

I put this in the Discord too, but just for good measure I'll open an issue too.

It appears that `ConvexPolyhedron::from_convex_hull(&points)` produces invalid topology:

```
use std::fs::File;
use parry3d::na::Point3;
use parry3d::shape::{ConvexPolyhedron, TriMeshFlags};

fn main() {
let decoded: Vec = bincode::deserialize_from(File::open("points.bin").unwrap()).unwrap();

let points : Vec> = decoded.chunks(3).map(|c| Point3::new(c[0], c[1], c[2])).collect();

let convex = ConvexPolyhedron::from_convex_hull(&points)
.expect("Failed to compute convex hull of mesh");

let (vertices, mut indices) = convex.to_trimesh();

let mut convex_mesh = parry3d::shape::TriMesh::new(vertices, indices)
.expect("Failed to convert convex polyhedron to triangle mesh");

// This panics.
convex_mesh.set_flags(TriMeshFlags::HALF_EDGE_TOPOLOGY).unwrap()
}
```

Here's the input data (remove the .txt, GitHub refused to upload it otherwise)

[points.bin.txt](https://github.com/user-attachments/files/18620783/points.bin.txt)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.