Search code examples
c++cgal

CGAL surface mesh - modify vertex coordinates


How do i modify CGAL surface mesh vertex index coordinates? For now i've been trying to change coordinates of vertices like this:

 for (auto vertex_iterator : mesh.vertices()) {
        Point_3 p(1,0,1);
        mesh.point(vertex_iterator) = p;
      }

Code above is just a sample, i'm not assigning same coordinates to all vertices.

After i try to do caluclations with it i get undefined results.


Solution

  • Actually I don't see what's wrong with your code, and I don't think your problems come from this. Can you give further information about your undefined results ?

    A precision though, a Surface_mesh::Vertex_index has no coordinate, it has an associated point, which has coordinates. That is what you access with mesh.point(vertex_index).