How to move points of a ON_Mesh ?(C++)

I try to smooth my mesh, but I don’t know how to change points position.
Is m_V[ ] altered directly ??

Yes. You should probably also re-calculate the face and vertex normals after changing the location of the mesh vertices m_V array.

What functions should I call ? :grin:

ComputeFaceNormals() and ComputeVertexNormals() (in that order).

Thanks you.
I don’t notice that it need to call those functions actively.

The mesh contains m_FN and m_N arrays that contain the face and vertex normals. These values are optional. If you change the vertex locations, and the normals are not changed, the mesh may not be rendered correctly.

I have a problem.
In a document,

In general,use one of ON_Mesh::SinglePrecisionVertices() or ON_Mesh::DoublePrecisionVertices() to get the array of vertex locations. If you modify m_V[] directly and HasDoublePrecisionVertices() is true, then you must make the same modifications to the array returned by DoublePrecisionVertices().

It mean I need to call DoublePrecisionVertices() ? :confounded:

If you modify the values of the single precision vertices in m_V[], then you must call UpdateDoublePrecisionVertices(). If double precision vertices are not present, this function does nothing.

The comments in opennurbs_mesh.h are extensive. Please review them.

I got it. Thanks. :smiley:

I found the example about this issue.

  dupe_mesh.InvalidateVertexBoundingBox();
  dupe_mesh.InvalidateVertexNormalBoundingBox();
  dupe_mesh.InvalidateCurvatureStats();
  dupe_mesh.m_FN.SetCount(0);
  dupe_mesh.m_N.SetCount(0);
  dupe_mesh.ComputeFaceNormals();
  dupe_mesh.ComputeVertexNormals();
  dupe_mesh.SetClosed(-1);

So many functions need to be called ??
In addition. It is slow to move points by SetVertex() than Setting m_V[].

I’m confused. This this a problem?

Yes it is. Download the openNURBS source if you are interested in knowing why.

As far as my know, I just call ComputeFaceNormals() and ComputeVertexNormals() ,
but this example shows many functions which are called. :scream:

Should I call them ?