## Problem using Convex Decomposiition (V-HCAD and HCAD)

Report crashes, strange behaviour, or apparent bugs
PvtSchneewitchen
Posts: 4
Joined: 12 Jul 2019, 09:37

### Problem using Convex Decomposiition (V-HCAD and HCAD)

Hi guys,

i have encountered a problem using the two methods of convex decomposition (HACD and V-HACD). Anytime i use V-HACD, the result of all next HACD-Decompisitions are corrupted.

I have different kind of meshes that i load into my scene. Depending on the kind of mesh it is better to use either HACD or V-HACD. Here is my example code:

Code: Select all


if(nObjectType == 1)then
--V-HACD
sim.addStatusbarMessage("simUtils: Convex decomposition of Bin...")
local tIntParams = {0, 0, 0, 0, 0, 100000, 20, 4, 4, 64}
local tFloatParams = {0.0, 0.0, 0.0, 0.0, 0.0, 0.002, 0.05, 0.05, 0.001, 0.0001}
nDecomposedHandle= sim.convexDecompose(nObjectHandle, 129, tIntParams, tFloatParams)
elseif(nObjectType == 2)then
--HACD
sim.addStatusbarMessage("simUtils: Convex decomposition of Workpiece...")
local tIntParams = {1, 650, 400, 4, 0, 0, 0, 0, 0, 0}
local tFloatParams = {0.01, 30.0, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}
nDecomposedHandle= sim.convexDecompose(nObjectHandle, 25, tIntParams, tFloatParams)
else
error("simUtils: Wrong object type for decomposition")
end

Now if i load an object with type 2 that is decomposed with HACD it works and looks like that:

If i load object type 1 decomposed with V-HACD and then again the same object type 2 the result looks like that:

Also the computation time is much longer for the second HACD-Decomposition.

I suggest that if i once use V-HACD, all following decompositions are done with V-HACD too, no matter which parameters i pass to the function.

Am i doing something wrong with the function calls or is this really a bug?

coppelia
Posts: 7527
Joined: 14 Dec 2012, 00:25

### Re: Problem using Convex Decomposiition (V-HCAD and HCAD)

Hello,

indeed, there is a bug! A not-so-satisfactory workaround would be to first handle all shapes that require the HACD algorithm, then all shapes that require the V-HACD algorithm... but once your have invoked the V-HACD algorithm from the API, there is no way back to the HACD algorithm except for enabling it via the GUI again.
Or... you wait for the V.4.0.0.rev4 release, out probably by the end of the day.

Cheers

PvtSchneewitchen
Posts: 4
Joined: 12 Jul 2019, 09:37

### Re: Problem using Convex Decomposiition (V-HCAD and HCAD)

coppelia wrote:
13 Jan 2020, 08:46
Hello,

indeed, there is a bug! A not-so-satisfactory workaround would be to first handle all shapes that require the HACD algorithm, then all shapes that require the V-HACD algorithm... but once your have invoked the V-HACD algorithm from the API, there is no way back to the HACD algorithm except for enabling it via the GUI again.
Or... you wait for the V.4.0.0.rev4 release, out probably by the end of the day.

Cheers
Thanks for the answer. Unfortunatetly your workaround isn't possible for me because i have a GUI where the User can load the objects in the order he wants. But if you say the rev4 is out soon, it's ok for me to wait.

coppelia
Posts: 7527
Joined: 14 Dec 2012, 00:25

### Re: Problem using Convex Decomposiition (V-HCAD and HCAD)

Ok, rev4 is online!

PvtSchneewitchen
Posts: 4
Joined: 12 Jul 2019, 09:37

### Re: Problem using Convex Decomposiition (V-HCAD and HCAD)

Nice. Tried it out with rev4. Now it Works!

Thanks for the help,
Cheers