Regular API function


Description Calculates the convex decomposition of a shape using the HACD or V-HACD algorithms. See also simGetQHull, simGetDecimatedMesh, simUngroupShape and simComputeMassAndInertia.
C synopsis simInt simConvexDecompose(simInt shapeHandle,simInt options,const simInt* intParams,const simFloat* floatParams)
C parameters
shapeHandle: handle of the shape to operate on
options: bit-coded:
bit0 set (1): the specified shape will be morphed into its convex decomposition. Otherwise, the convex decomposition will smply be added to the scene
bit1 set (2): specified convex decomposition parameters will be displayed in a dialog, allowing the user to modify them.
bit2 set (4): same convex decomposition parameters will be used as a previous call to this function. Only when this bit is set can the convex decomposition parameters be omitted.
bit3 set (8): HACD: extra points will be added when computing the concavity
bit4 set (16): HACD: faces points will be added when computing the concavity
bit5 set (32): each individual mesh of a compound shape will be handled on its own during decomposition, otherwise the compound shape is considered as a single mesh
bit6 (64): reserved. Do not set.
bit7 set (128): the V-HACD algorithm â—‹will be used. If not set, the HACD algorithm will be used.
bit8 set (256): V-HACD: pca is enabled (default is disabled).
bit9 set (512): V-HACD: tetrahedron-based approximate convex decomposition. If not set, then the voxel-based approximate convex decomposition will be used (default).
intParams: 10 int values:
intParams[0]: HACD: the minimum number of clusters to be generated (e.g. 1)
intParams[1]: HACD: the targeted number of triangles of the decimated mesh (e.g. 500)
intParams[2]: HACD: the maximum number of vertices for each generated convex hull (e.g. 100)
intParams[3]: HACD: the maximum number of iterations. Use 0 for the default value (i.e. 4).
intParams[4]: reserved. Set to 0.
intParams[5]: V-HACD: resolution (10000-64000000, 100000 is default).
intParams[6]: V-HACD: depth (1-32, 20 is default).
intParams[7]: V-HACD: plane downsampling (1-16, 4 is default).
intParams[8]: V-HACD: convex hull downsampling (1-16, 4 is default).
intParams[9]: V-HACD: max. number of vertices per convex hull (4-1024, 64 is default).
floatParams: 10 float values:
floatParams[0]: HACD: the maximum allowed concavity (e.g. 100.0)
floatParams[1]: HACD: the maximum allowed distance to get convex clusters connected (e.g. 30)
floatParams[2]: HACD: the threshold to detect small clusters. The threshold is expressed as a percentage of the total mesh surface (e.g. 0.25)
floatParams[3]: reserved. Set to 0.0
floatParams[4]: reserved. Set to 0.0
floatParams[5]: V-HACD: concavity (0.0-1.0, 0.0025 is default).
floatParams[6]: V-HACD: alpha (0.0-1.0, 0.05 is default).
floatParams[7]: V-HACD: beta (0.0-1.0, 0.05 is default).
floatParams[8]: V-HACD: gamma (0.0-1.0, 0.00125 is default).
floatParams[9]: V-HACD: min. volume per convex hull (0.0-0.01, 0.0001 is default).
C return value
-1 if operation was not successful. Otherwise the handle of the new shape, or the handle of the original shape when morphing.
Lua synopsis number shapeHandle=simConvexDecompose(number shapeHandle,number options,table_4 intParams,table_3 floatParams)
Lua parameters
Same as C-function
Lua return values
Same as C-function

All regular API functions on one page