Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise mesh geometry base class and inheritance chain #1107

Open
marip8 opened this issue Jan 17, 2025 · 1 comment
Open

Revise mesh geometry base class and inheritance chain #1107

marip8 opened this issue Jan 17, 2025 · 1 comment

Comments

@marip8
Copy link
Contributor

marip8 commented Jan 17, 2025

Is your feature request related to a problem? Please describe.

tesseract_geometry has a few classes of mesh geometries that are currently supported.

|-- Geometry
    |-- PolygonMesh
        |-- Mesh
        |-- ConvexMesh
    |-- CompoundMesh

When writing an environment to URDF, tesseract_urdf currently only supports writing Mesh types, which excludes any geometry that is ConvexMesh or CompoundMesh. #1081 updates the parser to write PolygonMesh to URDF, but that still excludes any geometry that is a CompoundMesh.

Additionally, polygon, triangle, and compound meshes are all capable of being convex. It seems like having a separate CompoundMesh type is relatively restrictive, as opposed to having a method to determine whether a given mesh is convex.

Describe the solution you'd like

We should have a single abstract Mesh base class that all mesh types inherit from. That might look something like this (effectively the same as the current PolygonMesh, but without the containers for data). Note, not all of these methods may be necessary to include in the abstract base class.

class Mesh
{
public:
  const std::shared_ptr<const tesseract_common::VectorVector3d>& getVertices() const = 0;
  const std::shared_ptr<const Eigen::VectorXi>& getFaces() const = 0;
  int getVertexCount() const = 0;
  int getFaceCount() const = 0;
  std::shared_ptr<const tesseract_common::Resource> getResource() const = 0;
  const Eigen::Vector3d& getScale() const = 0;
  const std::shared_ptr<const tesseract_common::VectorVector3d>& getNormals() const = 0;
  const std::shared_ptr<const tesseract_common::VectorVector4d>& getVertexColors() const = 0;
  std::vector<std::shared_ptr<const MeshMaterial>> getMaterial() const = 0;
  std::vector<const std::shared_ptr<MeshTexture>> getTextures() const = 0;

  // New method for determining if the mesh is convex
  bool isConvex() const = 0;
}

Then the class hierarchy could be something like this:

|-- Geometry
    |-- Mesh
        |-- PolygonMesh
            |-- TriangleMesh (currently called Mesh)
        |-- CompoundMesh

This change would eliminate the somewhat unnecessary ConvexMesh class; allow users to use convex hulls defined as triangle, polygon, or compound meshes; and allow us to write all supported mesh types to URDF more easily.

Describe alternatives you've considered

None

Additional context

No response

@Levi-Armstrong
Copy link
Contributor

I think we can combine them into a single class with the exception of a compound mesh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants