Subject: CGAL users discussion list
List archive
- From: Raphael Grimm <>
- To: <>
- Subject: [cgal-discuss] Segfault when generating a mesh from an implicit surface
- Date: Sat, 26 May 2018 21:01:07 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:BOrL6xEW2IjFAfV55lCnr51GYnF86YWxBRYc798ds5kLTJ7zpMuwAkXT6L1XgUPTWs2DsrQY07GQ6/iocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmDSwbaluIBmqsA7cqtQYjYx+J6gr1xDHuGFIe+NYxWNpIVKcgRPx7dqu8ZBg7ipdpesv+9ZPXqvmcas4S6dYDCk9PGAu+MLrrxjDQhCR6XYaT24bjwBHAwnB7BH9Q5fxri73vfdz1SWGIcH7S60/VDK/5KlpVRDokj8KOSA5/m/KicJ+gqxUrx29qBx+2IPUb52ZOeBic6/Bc94XR2xMVdtRWSxbBYO8apMCAfYbMuZAr4nyvUUBrR+jDgetHuPvyzpIhnrr1qA9yeQuCxnG3Aw6EN0QtHTYttr1NL0TUeCwyanF1jbDb/JK2Tvn9ofHbw0hrOiKULltf8TRzkwvGBnEjlWWsYHlPDKV1vgXv2eF8uVgSOSigHMkpQFpujWj29kgh43Tio4IxF3I7zt1zYgoKdGiS0N3fMaoHIVKuC2GKYd7R8AvT31qtSonz7ALt4C0czUFxZki2RLSa+CLf5WN7x/iSOqdPDl4iXdkdb+whRu97E2txvD4W8S61VtKoDdKn93Ku3sQzRLc8NKHReF4/kq52TaAyQTT6uZcLEAviaXUN4ctwrsqmZoStUTDGTL2mFnvgK+Vd0Uk5vGk5/j6brn8vZ+TK5N7hhv9MqQvhsyzG/o3PRUTX2SD+OS80qPs/VHhTblXkPE7lrPVvI3UKMgBuKK0DRJZ3pwg5hqiFzum1c4XnXgDLFJLYhKHiI3pNknUIP/iFfe/g06jnylvx/zcMb3hGJTNLn3GkLr6frZ96lJcxBAtwt9C+pJYEqsBL+7rWk/tqNzYCQc0PBC7w+n9DNVxz54RWWOUAqCFLaPSqkSI6/k0I+iMYY8VoCzyJ+Ik5/7ol385mEUScbOn3ZsNOziEGaEyKEqQZT/gg8wKDHwRlgs4Vu3jzlOYB219fXG3Cpg1/jEyBYbuIp3CQ4Xl1KaIxCeyE5kQaXpHD1WkEnb0MYiIRqFfO2qpPsZ9n2lcBvCaQIg72ET27V6o+/9cNuPRvxYgm9fm3dlx6ffUkEBg9j1oScmRzjPUFj0mriYzXzYzmZtHjwll0F7Sg6t5n7pVGcEBv6oUADd/DobVyqlBM/63Wg/FeYzTGk2tSZCjCDA1Sc8thtwPfwMlQpO5hRuF3Cu2RbIZiu7TCQ==
Hi,
I wanted to compare different methods to turn implicit surfaces into a mesh.
In the attached code I compared CGAL::make_mesh_3 with CGAL::make_surface_mesh.
I can deactivate the code using either of these functions using the defines at the top of the file.
If I activate only one of these functions, the executable generates the meshes.
So far all is good.
If I activate both functions to do the conversion, the executable segfaults:
void impl_mesh_via_all(double) 4
void impl_mesh_via_make_surface_mesh(double) 4
impl
convert
save
void impl_mesh_via_make_mesh_3(double) 4
impl
convert
Segmentation fault (core dumped)
I do not understand this, since both functions work if I only use one in the executable.
Can anyone tell me what the reason for this is?
Best Regards,
Raphael
--
Karlsruhe Institute of Technology (KIT)
Institute for Anthropomatics and Robotics (IAR)
High Performance Humanoid Technologies (H2T)
Raphael Grimm (M.Sc.)
Research Scientist
Adenauerring 2
Building 50.20, Room 334
76131 Karlsruhe, Germany
Phone: +49 721 608-47133
Fax: +49 721 608-48270
Email:
Web: http://h2t.anthropomatik.kit.edu/
KIT - The Research University in the Helmholtz Association
#define build_make_mesh_3 #define build_make_surface_mesh #include <fstream> #include <boost/current_function.hpp> #ifdef build_make_mesh_3 #include <CGAL/Mesh_complex_3_in_triangulation_3.h> #include <CGAL/Mesh_triangulation_3.h> #include <CGAL/Mesh_criteria_3.h> #include <CGAL/Implicit_mesh_domain_3.h> #include <CGAL/make_mesh_3.h> #include <CGAL/IO/facets_in_complex_3_to_triangle_mesh.h> #endif #ifdef build_make_surface_mesh #include <CGAL/Surface_mesh_default_triangulation_3.h> #include <CGAL/Complex_2_in_triangulation_3.h> #include <CGAL/make_surface_mesh.h> #include <CGAL/Implicit_surface_3.h> #include <CGAL/IO/facets_in_complex_2_to_triangle_mesh.h> #endif #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Polyhedron_3.h> using Poly = CGAL::Polyhedron_3<CGAL::Epick>; using ResultT = Poly; using Sphere_3 = typename CGAL::Epick::Sphere_3; using Point_3 = typename CGAL::Epick::Point_3 ; using Function = double (*)(const Point_3&); double sphere_function (const Point_3& p) { return CGAL::squared_distance(p, Point_3(CGAL::ORIGIN))-1; } // //////////////////////////////////////////////////////////////////////////// // // //////////////////////////////// make_mesh_3 /////////////////////////////// // // //////////////////////////////////////////////////////////////////////////// // #ifdef build_make_mesh_3 void impl_mesh_via_make_mesh_3(double r) { std::cout << BOOST_CURRENT_FUNCTION << " " << r << std::endl; using impl_mesh = CGAL::Implicit_mesh_domain_3<Function, CGAL::Epick>; using Traits = CGAL::Mesh_triangulation_3<impl_mesh,CGAL::Default, CGAL::Sequential_tag>::type; using C3t3 = CGAL::Mesh_complex_3_in_triangulation_3<Traits>; std::cout << " impl" << std::endl; impl_mesh impl(sphere_function, Sphere_3(CGAL::ORIGIN, r)); std::cout << " convert" << std::endl; CGAL::Mesh_criteria_3<Traits> criteria( CGAL::parameters::facet_angle = 30, CGAL::parameters::facet_size = 0.1, CGAL::parameters::facet_distance = 0.025, CGAL::parameters::cell_radius_edge_ratio = 2, CGAL::parameters::cell_size = 0.1 ); C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(impl, criteria); std::cout << " save" << std::endl; ResultT result; CGAL::facets_in_complex_3_to_triangle_mesh(c3t3, result); const std::string file = "sphere_impl_mesh_via_make_mesh_3_r_" + std::to_string(r) + ".off"; std::ofstream{file} << result; } #endif // //////////////////////////////////////////////////////////////////////////// // // ///////////////////////////// make_surface_mesh //////////////////////////// // // //////////////////////////////////////////////////////////////////////////// // #ifdef build_make_surface_mesh void impl_mesh_via_make_surface_mesh(double r) { std::cout << BOOST_CURRENT_FUNCTION << " " << r << std::endl; using Traits = typename CGAL::Surface_mesher::Surface_mesh_default_triangulation_3_generator<CGAL::Epick>::Type; using C2t3 = CGAL::Complex_2_in_triangulation_3<Traits>; using impl_surf = CGAL::Implicit_surface_3<typename Traits::Geom_traits, Function>; std::cout << " impl" << std::endl; impl_surf impl(sphere_function, CGAL::Epick::Sphere_3(CGAL::ORIGIN, r)); std::cout << " convert" << std::endl; Traits tr; C2t3 c2t3 (tr); CGAL::Surface_mesh_default_criteria_3<Traits> criteria(30, 0.1, 0.1); CGAL::make_surface_mesh(c2t3, impl, criteria, CGAL::Non_manifold_tag()); std::cout << " save" << std::endl; ResultT result; CGAL::facets_in_complex_2_to_triangle_mesh(c2t3, result); const std::string file = "sphere_impl_mesh_via_make_surface_mesh_r_" + std::to_string(r) + ".off"; std::ofstream{file} << result; } #endif // //////////////////////////////////////////////////////////////////////////// // // /////////////////////////////////// exec /////////////////////////////////// // // //////////////////////////////////////////////////////////////////////////// // void impl_mesh_via_all(double r) { std::cout << BOOST_CURRENT_FUNCTION << " " << r << std::endl; #ifdef build_make_surface_mesh impl_mesh_via_make_surface_mesh(r); #endif #ifdef build_make_mesh_3 impl_mesh_via_make_mesh_3(r); #endif } int main() { impl_mesh_via_all(4); impl_mesh_via_all(8); impl_mesh_via_all(16); impl_mesh_via_all(32); impl_mesh_via_all(64); impl_mesh_via_all(128); impl_mesh_via_all(256); impl_mesh_via_all(512); impl_mesh_via_all(1024); impl_mesh_via_all(2048); return 0; }
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
- [cgal-discuss] Segfault when generating a mesh from an implicit surface, Raphael Grimm, 05/26/2018
- Re: [cgal-discuss] Segfault when generating a mesh from an implicit surface, Mael Rouxel-Labbé, 05/29/2018
Archive powered by MHonArc 2.6.18.