CGAL / cgal

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

Control 3D mesh densities for multiple sharp edges/features? I.e. graded tet-mesh densities. #4026

Closed tcdoe closed 5 years ago

tcdoe commented 5 years ago

Hello, I need to have graded 3D mesh densities (from polyhedral object(s) OFF, not image). I'm making good progress with "domain.detect_features();" to identify the creases/edges, but all edges then have same density (first criteria fedge i think). For example, here (fig below) is a simple cylinder result. What I need is finer mesh at the top of the cylinder, or ideally control mesh density for both lower and upper (or multiple) edge 1-d polyline(s) that are found by detect_features.

image

Is that possible? I hope I haven't missed something obvious I'm new to cpp/cgal. FYI I'm just using the simple cpp example mesh_polyhedral_domain_with_features.

Also I think there may be a possibility of controlling using the mesh generator criteria, because when I read this man page, it says, "- _cellsize. This parameter controls the size of mesh tetrahedra. It is either a scalar or a spatially variable scalar field. It provides an upper bound on the circumradii of the mesh tetrahedra."

So maybe I can use edge-detected nodes or facets to make/compute this scalar field? A related question is that I would like to be able to manipulate the polylines generated by detect_features( ) but I can't figure out where the function definition is. I'm very new to cpp so again very sorry if this is obvious where I should "see" and control the detected polylines or related code. There is a lot of other interesting things I would like to do in detect_features(). Maybe I could duplicate that into a stand-alone function if that is possible.

Thank you for any help/info.

System info: Intel i7, Win 10, VS 17, CGAL 4.14

lrineau commented 5 years ago

There are examples if the documentation of Mesh_3 about that subject. Let me know if that is sufficient for you.

As this issue is not really a bug but a question, I close it for book-keeping. But we can continue and discuss here, and even reopen the issue if it converges to a real issue...

tcdoe commented 5 years ago

Hello thanks. I've looked at the examples carefully, and have them all working, but there is nothing there that enables me to figure out how to prescribe mesh density on specific nodes/facets/polylines, or otherwise addresses my other question about how to access/manipulate the polylines that are identified by the 'detect_features()'. Apologies for any confusion, this is not a 'bug' but is a question and feature interest.

lrineau commented 5 years ago

As for detect_features, the function starts here: https://github.com/CGAL/cgal/blob/a236d22e2dababae9c67b5d2e4e4e3c8f3b264dd/Mesh_3/include/CGAL/Polyhedral_mesh_domain_with_features_3.h#L338 and it relies a lot on CGAL::PMP::sharp_edges_segmentation: https://github.com/CGAL/cgal/blob/423c4fbd1116610526f485503a301a982537ddbc/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/detect_features.h#L427

lrineau commented 5 years ago

The examples of Mesh_3 show how to specify a different density depending on the spatial location (it depends on the point p passes as argument). There are also ways to make the density depend on the "surface patch id" of facets, or on the "curve id" of sharp edges. But it is true that, using detect_features, you have no feedback on the indices of sharp 1D curves.