How to decompose a complex mesh to simple geometry shape programmatically? I have a complex geometry mesh object, which is an irregular shape.

I want to redraw that complex geometry mesh object using multiple simple primitive shapes.

For example, I want to use cuboid, sphere and cylinder to represent a complex geometry mesh object.

I am given only the vertices points, triangular of that complex geometry mesh.

How do I decompose the geometry shape into cuboid, sphere, cylinder.

Please ask if you need details.
Thank you.
It might be a bit of an overkill, but you could use spatial partitioning, such as Octrees. 

Once you have it built, you can start evaluating partitions, given a max depth level of your choice, and form bounding volumes with the vertices inside each partition.

You can test all of your shapes for each partition and choose the one that approximates the best all vertices you are enclosing in it (you can measure this by, for example, the volume which, while enclosing all vertices, takes up the less volume).

PS: I've never tried anything like this, is purely theoretical