Page 1 of 1

How do I programmatically check if compound shape is convex?

Posted: 05 Oct 2018, 22:19
by Adrian
Hi!

Is there a way to programmatically find out whether a compound shape is convex?

I would like to scan my scene for shapes that are respondable and non-convex, since these types of shapes might slow down the simulation a lot. So I am trying to write an add-on that creates a list of all such shapes in the scene.

I know that I can use sim.getShapeGeomInfo() to check if a simple shape is convex, but this doesn't work for compound shapes. Alternatively, I could use sim.computeMassAndInertia(), which returns 0 if a compound shape is non-convex. However, it will also change the mass and inertia properties of the shape.

The only solution I can think of is to first duplicate each compound shape and then run sim.computeMassAndIntertia() on the duplicate. And then delete the duplicate again.

Is there a better way to simply check if a (compound) shape is convex?

Thank you!

Re: How do I programmatically check if compound shape is convex?

Posted: 09 Oct 2018, 16:50
by fferri
Not sure wether V-REP can natively do this.

The CGAL library has convexity checking routines.

If you want to use those routines, consider extending or basing your work off the Surface Reconstruction plugin, which already uses CGAL's functions.

Re: How do I programmatically check if compound shape is convex?

Posted: 10 Oct 2018, 07:13
by coppelia
Hello,

you can use sim.getObjectInt32Parameter with sim.shapeintparam_convex or sim.shapeintparam_compound.

Cheers

Re: How do I programmatically check if compound shape is convex?

Posted: 11 Oct 2018, 15:15
by Adrian
Thank you!