dimforge / dimforge/ncollide

Problems with hacd algorithm

Open
#191 0 comments 0 reactions 0 assignees View on GitHub
bug P-low
Dominant language
Rust
Stars
926
Forks
104
PR merge metrics
No merged PRs in 30d

Description

First of all, it's very cool that you implemented this great algorithm!

However, it kinda fails when I try to decompose the following simple mesh:

![p1](https://user-images.githubusercontent.com/14802542/37856209-83554fa8-2ef3-11e8-8785-04173e8a38b1.png)

`hacd` here doesn't result in (what I'd expect) 2 or 3 separate convex objects, but 28 single triangles.

I wasn't sure if it's a problem that my mesh has a unified index buffer and therefore duplicate vertices?
Anyway, the length of the resulting decomposition changes into 13 when calling `split_index_buffer` while recovering topology before, and in this case, at least the first element in the vec of trimeshes looks more or less correct:

![p2](https://user-images.githubusercontent.com/14802542/37856219-9027452e-2ef3-11e8-8b8b-300c4b24d328.png)

But the remaining 12 also seem to be just triangles.

I called `hacd` with error = 0.03 and min_components = 0. Changing these values doesn't help.

Here an .obj representation of the above mesh (here with already splitted indices):

> g Mesh
v 0 0 0
v 1 0 0
v 1 0 1
v 0 0 1
v 0 1 0
v 1 1 0
v 1 1 1
v 0 1 1
v 2 1 0
v 2 1 1
v 2 0 1
v 2 0 0
v 1 1 2
v 0 1 2
v 0 0 2
v 1 0 2
vn 0 -1 0
vn 0 0 -1
vn -1 0 0
vn 0 1 0
vn 0 0 1
vn 1 0 0
f 1//1 2//1 3//1 4//1
f 5//2 6//2 2//2 1//2
f 8//3 5//3 1//3 4//3
f 5//4 8//4 7//4 6//4
f 12//2 2//2 6//2 9//2
f 9//4 6//4 7//4 10//4
f 10//5 7//5 3//5 11//5
f 11//1 3//1 2//1 12//1
f 9//6 10//6 11//6 12//6
f 16//6 3//6 7//6 13//6
f 13//4 7//4 8//4 14//4
f 14//3 8//3 4//3 15//3
f 15//1 4//1 3//1 16//1
f 13//5 14//5 15//5 16//5

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.