ncollide icon indicating copy to clipboard operation
ncollide copied to clipboard

Problems with hacd algorithm

Open eldyer opened this issue 6 years ago • 0 comments

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

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

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

eldyer avatar Mar 23 '18 23:03 eldyer