Hello CGAL community, I need a small help with a surface extraction that
I need to implement. I'm creating a surface for a finite element algorithm. And I need the edges to have a minimum size restriction. I would be perfect if the SD of all the edges were as small as possible. Here is a the code. Thx for the help, btw. Best regards, Ignacio. typedef CGAL::Simple_cartesian<double> Kernel; typedef Kernel::Point_2 Point_2; // default triangulation for Surface_mesher typedef CGAL::Surface_mesh_default_triangulation_3 Tr; // c2t3 typedef CGAL::Complex_2_in_triangulation_3<Tr> C2t3; typedef Tr::Geom_traits GT; typedef CGAL::Gray_level_image_3<GT::FT, GT::Point_3> Gray_level_image; typedef CGAL::Implicit_surface_3<GT, Gray_level_image> Surface_3; Tr tr; // 3D-Delaunay triangulation C2t3 c2t3 (tr); // 2D-complex in 3D-Delaunay triangulation char *inriaFile; char *outputFile; Gray_level_image image(inriaFile, 0.3); GT::Point_3 bounding_sphere_center(109,109,67); GT::FT bounding_sphere_squared_radius = float(218) * float(218) * float(2); GT::Sphere_3 bounding_sphere(bounding_sphere_center, bounding_sphere_squared_radius); Surface_3 surface(image, bounding_sphere, 0.00001); CGAL::Surface_mesh_default_criteria_3<Tr> criteria(30,2,2); CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Manifold_tag()); //for(C2t3::Vertex_iterator iter(c2t3.vertices_begin()); iter != c2t3.vertices_end(); iter++ ) { //std::cout << iter->point().x() << iter->point().y() << iter->point() << std::endl; ////Point p(iter->point()); //} std::ofstream out(outputFile); CGAL::output_surface_facets_to_off (out, c2t3); std::cout << c2t3.number_of_facets() << std::endl; std::cout << "qRx : Surface, final number of points: " << tr.number_of_vertices() << "\n"; std::cout << "qRx: Surface, end!!" << std::endl; -- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss |
Le Thursday, June 8, 2017 8:59:46 PM CEST Ignacio Javier Osorio Wallace a ?
crit : > Hello CGAL community, I need a small help with a surface extraction that > I need to implement. > > I'm creating a surface for a finite element algorithm. And I need the > edges to have a minimum size restriction. I would be perfect if the SD > of all the edges were as small as possible. Hi, You cannot define a minimal size for edges (or triangles) when using `CGAL::make_surface_mesh`. If the size of edges is significantly smaller than the size criterion given to the critera object (`CGAL::Surface_mesh_default_criteria_3`), then that probably means that the geometry of the domain surface has locally a small feature size. You may try post-process the result of `CGAL::make_surface_mesh` with a surface simplification algorithm: export the `c2t3` object to a polyhedron, and then use the methods from the CGAL chapter "Triangulated Surface Mesh Simplification": http://doc.cgal.org/4.10/Surface_mesh_simplification/index.html But the global guaranties (no self-intersection) will no longer be guaranteed. > Here is a the code. > Thx for the help, btw. > Best regards, > Ignacio. > > typedef CGAL::Simple_cartesian<double> Kernel; > typedef Kernel::Point_2 Point_2; > > // default triangulation for Surface_mesher > typedef CGAL::Surface_mesh_default_triangulation_3 Tr; > // c2t3 > typedef CGAL::Complex_2_in_triangulation_3<Tr> C2t3; > typedef Tr::Geom_traits GT; > > typedef CGAL::Gray_level_image_3<GT::FT, GT::Point_3> Gray_level_image; > typedef CGAL::Implicit_surface_3<GT, Gray_level_image> Surface_3; > > Tr tr; // 3D-Delaunay triangulation > C2t3 c2t3 (tr); // 2D-complex in 3D-Delaunay triangulation > char *inriaFile; > char *outputFile; > > Gray_level_image image(inriaFile, 0.3); > > GT::Point_3 bounding_sphere_center(109,109,67); > > GT::FT bounding_sphere_squared_radius = float(218) * float(218) * > float(2); > > GT::Sphere_3 bounding_sphere(bounding_sphere_center, > bounding_sphere_squared_radius); > > Surface_3 surface(image, bounding_sphere, 0.00001); > > CGAL::Surface_mesh_default_criteria_3<Tr> criteria(30,2,2); > > CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Manifold_tag()); > > //for(C2t3::Vertex_iterator iter(c2t3.vertices_begin()); iter != > c2t3.vertices_end(); iter++ ) { > //std::cout << iter->point().x() << iter->point().y() << iter->point() > << std::endl; > ////Point p(iter->point()); > //} > > std::ofstream out(outputFile); > CGAL::output_surface_facets_to_off (out, c2t3); > std::cout << c2t3.number_of_facets() << std::endl; > > std::cout << "qRx : Surface, final number of points: " << > tr.number_of_vertices() << "\n"; > std::cout << "qRx: Surface, end!!" << std::endl; -- Laurent Rineau, PhD R&D Engineer at GeometryFactory http://www.geometryfactory.com/ Release Manager of the CGAL Project http://www.cgal.org/ -- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss |
Thx a lot Laurent,
So I'm reading about it. And in order to use the minimum length required as the stop predicate of the function. I need to: #include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_stop_predicate.h> which is not being found. I wonder if I need to link other flags to the compiler? (I already have CGAL, CGAL_CORE and CGAL_ImageIO, and boost stuff). I did follow the documentation: http://doc.cgal.org/latest/Surface_mesh_simplification/index.html found how to convert the c2t3 to a polyhedron: http://doc.cgal.org/Manual/3.6.1/include/CGAL/IO/output_surface_facets_to_polyhedron.h and I'm trying to make the algorithm work with the edge_length_stop_predicate using this example: https://github.com/CGAL/cgal/blob/master/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_all_short_edges.cpp I hope I'm on the right path. Thx a lot for the support, best regards, Ignacio. El 2017-06-09 05:20, Laurent Rineau (CGAL/GeometryFactory) escribiÃ³: > Le Thursday, June 8, 2017 8:59:46 PM CEST Ignacio Javier Osorio Wallace > a ? > crit : >> Hello CGAL community, I need a small help with a surface extraction >> that >> I need to implement. >> >> I'm creating a surface for a finite element algorithm. And I need the >> edges to have a minimum size restriction. I would be perfect if the SD >> of all the edges were as small as possible. > > Hi, > > You cannot define a minimal size for edges (or triangles) when using > `CGAL::make_surface_mesh`. If the size of edges is significantly > smaller than > the size criterion given to the critera object > (`CGAL::Surface_mesh_default_criteria_3`), then that probably means > that the > geometry of the domain surface has locally a small feature size. > > You may try post-process the result of `CGAL::make_surface_mesh` with a > surface simplification algorithm: export the `c2t3` object to a > polyhedron, > and then use the methods from the CGAL chapter "Triangulated Surface > Mesh > Simplification": > > http://doc.cgal.org/4.10/Surface_mesh_simplification/index.html > > But the global guaranties (no self-intersection) will no longer be > guaranteed. > >> Here is a the code. >> Thx for the help, btw. >> Best regards, >> Ignacio. >> >> typedef CGAL::Simple_cartesian<double> Kernel; >> typedef Kernel::Point_2 Point_2; >> >> // default triangulation for Surface_mesher >> typedef CGAL::Surface_mesh_default_triangulation_3 Tr; >> // c2t3 >> typedef CGAL::Complex_2_in_triangulation_3<Tr> C2t3; >> typedef Tr::Geom_traits GT; >> >> typedef CGAL::Gray_level_image_3<GT::FT, GT::Point_3> >> Gray_level_image; >> typedef CGAL::Implicit_surface_3<GT, Gray_level_image> Surface_3; >> >> Tr tr; // 3D-Delaunay triangulation >> C2t3 c2t3 (tr); // 2D-complex in 3D-Delaunay triangulation >> char *inriaFile; >> char *outputFile; >> >> Gray_level_image image(inriaFile, 0.3); >> >> GT::Point_3 bounding_sphere_center(109,109,67); >> >> GT::FT bounding_sphere_squared_radius = float(218) * float(218) * >> float(2); >> >> GT::Sphere_3 bounding_sphere(bounding_sphere_center, >> bounding_sphere_squared_radius); >> >> Surface_3 surface(image, bounding_sphere, 0.00001); >> >> CGAL::Surface_mesh_default_criteria_3<Tr> criteria(30,2,2); >> >> CGAL::make_surface_mesh(c2t3, surface, criteria, >> CGAL::Manifold_tag()); >> >> //for(C2t3::Vertex_iterator iter(c2t3.vertices_begin()); iter != >> c2t3.vertices_end(); iter++ ) { >> //std::cout << iter->point().x() << iter->point().y() << iter->point() >> << std::endl; >> ////Point p(iter->point()); >> //} >> >> std::ofstream out(outputFile); >> CGAL::output_surface_facets_to_off (out, c2t3); >> std::cout << c2t3.number_of_facets() << std::endl; >> >> std::cout << "qRx : Surface, final number of points: " << >> tr.number_of_vertices() << "\n"; >> std::cout << "qRx: Surface, end!!" << std::endl; > > > > -- > Laurent Rineau, PhD > R&D Engineer at GeometryFactory > http://www.geometryfactory.com/ > Release Manager of the CGAL Project http://www.cgal.org/ -- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss |
Hello,
What do you mean with "which is not found" ?? You find it, but the compiler does not? Do the examples in examples/Surface_mesh_simplification compile when unmodified? andreas On 21/06/2017 19:42, Ignacio Javier Osorio Wallace wrote: > Thx a lot Laurent, > > So I'm reading about it. And in order to use the minimum length required > as the stop predicate of the function. I need to: > > #include > <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_stop_predicate.h> > > > which is not being found. I wonder if I need to link other flags to the > compiler? (I already have CGAL, CGAL_CORE and CGAL_ImageIO, and boost > stuff). > > I did follow the documentation: > http://doc.cgal.org/latest/Surface_mesh_simplification/index.html > found how to convert the c2t3 to a polyhedron: > http://doc.cgal.org/Manual/3.6.1/include/CGAL/IO/output_surface_facets_to_polyhedron.h > > and I'm trying to make the algorithm work with the > edge_length_stop_predicate using this example: > https://github.com/CGAL/cgal/blob/master/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_all_short_edges.cpp > > > I hope I'm on the right path. > Thx a lot for the support, > best regards, > Ignacio. > > El 2017-06-09 05:20, Laurent Rineau (CGAL/GeometryFactory) escribiÃ³: >> Le Thursday, June 8, 2017 8:59:46 PM CEST Ignacio Javier Osorio >> Wallace a ? >> crit : >>> Hello CGAL community, I need a small help with a surface extraction that >>> I need to implement. >>> >>> I'm creating a surface for a finite element algorithm. And I need the >>> edges to have a minimum size restriction. I would be perfect if the SD >>> of all the edges were as small as possible. >> >> Hi, >> >> You cannot define a minimal size for edges (or triangles) when using >> `CGAL::make_surface_mesh`. If the size of edges is significantly >> smaller than >> the size criterion given to the critera object >> (`CGAL::Surface_mesh_default_criteria_3`), then that probably means >> that the >> geometry of the domain surface has locally a small feature size. >> >> You may try post-process the result of `CGAL::make_surface_mesh` with a >> surface simplification algorithm: export the `c2t3` object to a >> polyhedron, >> and then use the methods from the CGAL chapter "Triangulated Surface Mesh >> Simplification": >> >> http://doc.cgal.org/4.10/Surface_mesh_simplification/index.html >> >> But the global guaranties (no self-intersection) will no longer be >> guaranteed. >> >>> Here is a the code. >>> Thx for the help, btw. >>> Best regards, >>> Ignacio. >>> >>> typedef CGAL::Simple_cartesian<double> Kernel; >>> typedef Kernel::Point_2 Point_2; >>> >>> // default triangulation for Surface_mesher >>> typedef CGAL::Surface_mesh_default_triangulation_3 Tr; >>> // c2t3 >>> typedef CGAL::Complex_2_in_triangulation_3<Tr> C2t3; >>> typedef Tr::Geom_traits GT; >>> >>> typedef CGAL::Gray_level_image_3<GT::FT, GT::Point_3> Gray_level_image; >>> typedef CGAL::Implicit_surface_3<GT, Gray_level_image> Surface_3; >>> >>> Tr tr; // 3D-Delaunay triangulation >>> C2t3 c2t3 (tr); // 2D-complex in 3D-Delaunay triangulation >>> char *inriaFile; >>> char *outputFile; >>> >>> Gray_level_image image(inriaFile, 0.3); >>> >>> GT::Point_3 bounding_sphere_center(109,109,67); >>> >>> GT::FT bounding_sphere_squared_radius = float(218) * float(218) * >>> float(2); >>> >>> GT::Sphere_3 bounding_sphere(bounding_sphere_center, >>> bounding_sphere_squared_radius); >>> >>> Surface_3 surface(image, bounding_sphere, 0.00001); >>> >>> CGAL::Surface_mesh_default_criteria_3<Tr> criteria(30,2,2); >>> >>> CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Manifold_tag()); >>> >>> //for(C2t3::Vertex_iterator iter(c2t3.vertices_begin()); iter != >>> c2t3.vertices_end(); iter++ ) { >>> //std::cout << iter->point().x() << iter->point().y() << iter->point() >>> << std::endl; >>> ////Point p(iter->point()); >>> //} >>> >>> std::ofstream out(outputFile); >>> CGAL::output_surface_facets_to_off (out, c2t3); >>> std::cout << c2t3.number_of_facets() << std::endl; >>> >>> std::cout << "qRx : Surface, final number of points: " << >>> tr.number_of_vertices() << "\n"; >>> std::cout << "qRx: Surface, end!!" << std::endl; >> >> >> >> -- >> Laurent Rineau, PhD >> R&D Engineer at GeometryFactory http://www.geometryfactory.com/ >> Release Manager of the CGAL Project http://www.cgal.org/ > -- Andreas Fabri, PhD Chief Officer, GeometryFactory Editor, The CGAL Project phone: +33.492.954.912 skype: andreas.fabri -- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss |
My boss recently explained how he needed a surface/volume mesh for a
finite element calculations. I have a binary volume from which I have to extract the surface and eventually transforme it to a tetrahedral volume. That's already working, but! I have to create the mesh with a particular edge length. I don't know how to do that. Currently, my mesh is being created with larger edges from what i need. Thx, best regards, Ignacio. -- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss |
Free forum by Nabble | Edit this page |