gazebosim/sdformat

Consider adding `assert_convex` to mesh specification

Opened this issue · 0 comments

Desired behavior

The //mesh/@optimization attribute is being added in #1382 with recognition for 3 values of the attribute:

  • "" (empty string): no mesh optimization is done
  • convex_hull: use the convex hull of the specified mesh
  • convex_decomposition: decompose the mesh into convex sub-meshes (using parameters from //mesh/convex_decomposition)

It could also be useful for a user to specify assert_convex when they believe a mesh is convex and that an error should be raised if it is found to not be convex. Verifying this would require code from gz-common (or similar) to get the mesh data for analysis, so it couldn't be added directly to sdformat, but it could be useful for some users.

There is a use case for wanting to specify both assert_convex and convex_hull (a user may want to use the convex_hull optimization with a mesh known to be convex since it may consolidate triangle faces into larger polygon faces), so I would suggest a new attribute //mesh/@assert_convex.

Alternatives considered

Instead of a new attribute, the assert_convex behavior could be specified in //mesh/@optimization.

Also, I've mentioned this as a potential use case, but I'm not sure how much user demand there actually is. The convex_hull option may be adequate, combined with a CLI tool in another repository for evaluating how close to convex a given mesh is.

Implementation suggestion

Additional context

Thanks to @SeanCurtis-TRI for suggesting the assert_convex name and discussing this potential use case.