Use some color property maps in the surface_mesh basic draw example

This commit is contained in:
Mael Rouxel-Labbé 2022-12-08 01:14:15 +01:00
parent c670c24e3a
commit 9833bcf9f0
1 changed files with 17 additions and 0 deletions

View File

@ -20,6 +20,23 @@ int main(int argc, char* argv[])
return EXIT_FAILURE;
}
// Internal color property maps are used if they exist and are called "v:color", "e:color" and "f:color".
auto vcm = sm.add_property_map<Mesh::Vertex_index, CGAL::IO::Color>("v:color").first;
auto ecm = sm.add_property_map<Mesh::Edge_index, CGAL::IO::Color>("e:color").first;
auto fcm = sm.add_property_map<Mesh::Face_index>("f:color", CGAL::IO::white() /*default*/).first;
for(auto v : vertices(sm))
{
if(v.idx()%2)
put(vcm, v, CGAL::IO::black());
else
put(vcm, v, CGAL::IO::blue());
}
for(auto e : edges(sm))
put(ecm, e, CGAL::IO::gray());
// Draw!
CGAL::draw(sm);
return EXIT_SUCCESS;