echelon
echelon

Reputation: 143

Drawing a colored mesh in CGAL

In CGAL have a Surface_mesh<Point_3> with Surface_mesh::Property_map<Surface_mesh::Face_index, CGAL::Color>. I use CGAL::draw() method to draw this mesh, however the different colors of faces don't reflect. What am I missing?

Upvotes: 2

Views: 748

Answers (2)

gdamiand
gdamiand

Reputation: 681

The current version of basic viewer of Surface mesh does not take into account the color of faces.

However, it is easy to change the code.

  1. Have a look to the file draw_surface_mesh.h.
  2. Add a functor MyColorFunctorSM (inspired by the existing DefaultColorFunctorSM) that returns the color of a face given its index
  3. Replace in the draw function DefaultColorFunctorSM by your new functor MyColorFunctorSM.

(If you don't want to modity the CGAL file, you can define your functor in your code, and copy/paste the draw function in your code before to modify it).

Upvotes: 1

mgimeno
mgimeno

Reputation: 726

I think you must hit the M key once in the viewer, to activate the 'multicolor' feature.

Upvotes: 1

Related Questions