CGAL / cgal

The public CGAL repository, see the README below
https://github.com/CGAL/cgal#readme
Other
4.87k stars 1.38k forks source link

Isotropic Remeshing return #6379

Closed TankTheSerker closed 2 years ago

TankTheSerker commented 2 years ago

Issue Details

I tried to run the example code from documentation and use it on the cube. I compile the Polygon_mesh_processing/isotropic_remeshing_example.cpp

I am expecting result like this: image

However the return that the API gave is image

As we can see, the edge is rough, how can I maintain the original shape but create multiple faces on it? Thanks

sloriot commented 2 years ago

you have to use the named parameter edge_is_constrained_map() documented here.

If you do not already know the edges that you want to protect, you can use the function CGAL::Polygon_mesh_processing::detect_sharp_edges().

Example call:

typedef boost::property_map<Mesh, CGAL::edge_is_feature_t>::type EIFMap;
  EIFMap eif = get(CGAL::edge_is_feature, mesh);
  [PMP::detect_sharp_edges](https://doc.cgal.org/latest/Polygon_mesh_processing/group__PMP__detect__features__grp.html#gafc344ee740da7ca1d84a1da709fdaf48)(mesh, 60, eif);

PMP::isotropic_remeshing(faces(mesh), target_el, mesh, CGAL::parameters::edge_is_constrainted_map(eif));
TankTheSerker commented 2 years ago

you have to use the named parameter edge_is_constrained_map() documented here.

If you do not already know the edges that you want to protect, you can use the function CGAL::Polygon_mesh_processing::detect_sharp_edges().

Example call:

typedef boost::property_map<Mesh, CGAL::edge_is_feature_t>::type EIFMap;
  EIFMap eif = get(CGAL::edge_is_feature, mesh);
  [PMP::detect_sharp_edges](https://doc.cgal.org/latest/Polygon_mesh_processing/group__PMP__detect__features__grp.html#gafc344ee740da7ca1d84a1da709fdaf48)(mesh, 60, eif);

PMP::isotropic_remeshing(faces(mesh), target_el, mesh, CGAL::parameters::edge_is_constrainted_map(eif));

Thanks, was able to get the expected result. I'm new to the library and to make sure that I am using it correctly, I want to ask another question, so I used the PMP::detect_sharp_edges();

It is asking for 3 parameters, Mesh, angle_in_deg and edge_is_feature_map for the edge_is_feature_map, I passed the eif, but for angle_in_deg is currently hardcoded to 60, what will be the effect if angle_in_deg is different?

PMP::detect_sharp_edges(mesh, 60, eif);

sloriot commented 2 years ago

The name of the function comes with a link to the doc where you can read:

angle_in_deg gives the maximum angle (in degrees) between the two normal vectors of adjacent triangles. For an edge of the input polygon mesh, if the angle between the two normal vectors of its incident facets is bigger than the given bound, then the edge is marked as being a feature edge.