1

I am trying to use this function to compute the center of mass of a mesh structure. This is the signature:

Point   calc_centroid (MeshHandle _mh) const

So it takes a MeshHandle object as a parameter. My question is, how to get such a MeshHandle from a mesh instance? I have a mesh instance defined as

typedef OpenMesh::TriMesh_ArrayKernelT<>  MyMesh;
MyMesh mesh;

however, I seem to be unable to get a MeshHandle to it.

Botond
  • 2,640
  • 6
  • 28
  • 44

1 Answers1

3

A MeshHandle holds no reference to a mesh instance. You can just create one with a default constructor:

MyMesh mesh;
mesh.calc_centroid(OpenMesh::MeshHandle());
jsb
  • 938
  • 6
  • 15
  • Note: When I tried this code, I had to `#include ` to prevent a compile error in `calc_centroid`. – jsb Mar 16 '21 at 08:41
  • Update: The missing `#include` has been fixed in the latest OpenMesh version. – jsb Mar 17 '21 at 10:16