Subject: CGAL users discussion list
List archive
- From: "Laurent Rineau (CGAL/GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Delauny_Mesher gives a CGAL::Assertion_exception
- Date: Wed, 25 Jul 2012 15:33:45 +0200
- Organization: GeometryFactory
Hi Gert,
Thanks for your complete bug report. It is indeed a bug in Mesh_2. One
assertion that I added a few months ago was not well thought.
In at line 425 of the file CGAL-4.0.2/include/CGAL/Mesh_2/Refine_edges.h
remove or comment the following lines:
CGAL_assertion_msg(zone.locate_type != Tr::FACE ||
zone.fh == f || zone.fh == n,
"Your data set contains at least a vertex that is "
"very close to \n"
" a constrained edge! "
"Mesh_2 cannot mesh that sort of data set.");
That assertion is wrong, and our set of automatic tests was not able to catch
that bug. I will think about a proper way to fix the bug.
Le mercredi 25 juillet 2012 02:20:13 gerth a écrit :
> Hi!
>
> I am new to CGAL and I try to refine some existing triangles such that they
> get filled with a triangular Delauny mesh. I walked through some tutorials
> but ended up with code that seems buggy to me. In some cases it works as
> expected, but as soon as I change some input coordinate values it gives me
> an CGAL::Assertion_exception. The exact error is:
>
> Unhandled exception at 0x7c812afb in gui.exe: Microsoft C++ exception:
> CGAL::Assertion_exception at memory location 0x0107c438..
>
>
>
> So here is my code:
>
> //Includes
> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
> #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
> #include <CGAL/Cartesian.h>
> #include <CGAL/Delaunay_triangulation_2.h>
> #include <CGAL/Constrained_Delaunay_triangulation_2.h>
> #include <CGAL/Delaunay_mesher_2.h>
> #include <CGAL/Delaunay_mesh_face_base_2.h>
> #include <CGAL/Delaunay_mesh_size_criteria_2.h>
> #include <CGAL/Triangulation_face_base_2.h>
> #include <CGAL/Triangulation_face_base_with_info_2.h>
> #include <CGAL/Polygon_2.h>
> #include <CGAL/Triangulation_2.h>
> #include <CGAL/Vector_3.h>
> #include <CGAL/Triangulation_conformer_2.h>
> #include <CGAL/number_utils.h>
>
> typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
> typedef CGAL::Triangulation_vertex_base_2<K> Vb;
> typedef CGAL::Delaunay_mesh_face_base_2<K> Fb_fine;
> typedef CGAL::Triangulation_data_structure_2<Vb, Fb_fine>
> TDS_fine;
> typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS_fine>
> CDT_fine;
> typedef CGAL::Delaunay_mesh_size_criteria_2<CDT_fine>
> Criteria_fine;
> typedef CGAL::Delaunay_mesher_2<CDT_fine, Criteria_fine>
> Mesher_fine;
> typedef CDT_fine::Point Point_fine;
> typedef CDT_fine::Vertex_handle
> Vertex_handle_fine;
> typedef CDT_fine::Vertex_iterator
> Vertex_iterator_fine;
> typedef CDT_fine::Triangle Triangle_fine;
> typedef CDT_fine::Vertex Vertex_fine;
>
> int main()
> {
> //Fine meshing a triangle
> //
> CDT_fine cdt_fine;
> Vertex_handle_fine v_zero, v_one, v_two;
>
> //Define 2d points
> //
> double v00 = 0.0;
> double v01 = 0.0;
>
> double v10 = -3.5240345245692879;
> double v11 = -12.4; //change this value to -12.429654299747199 and
> everything works fine
>
> double v20 = -9.3417057867627591;
> double v21 = 2.6237986627966166;
>
>
> //Insert 3 points and 3 edges as constraints
> //
> v_zero = cdt_fine.insert( Point_fine(v00, v01 ) );
> v_one = cdt_fine.insert( Point_fine(v10, v11 ) );
> v_two = cdt_fine.insert( Point_fine(v20, v21 ) );
>
> cdt_fine.insert_constraint( v_zero, v_one );
> cdt_fine.insert_constraint( v_one, v_two );
> cdt_fine.insert_constraint( v_two, v_zero );
>
>
>
> //Refine mesh #1
> //
> Mesher_fine mesher_fine(cdt_fine);
> mesher_fine.refine_mesh(); //works
>
> //Refine mesh #2
> //
> mesher_fine.set_criteria(Criteria_fine(0.125, 1.0));
> mesher_fine.refine_mesh(); //fails
>
> std::cout << "Number of faces: " << cdt_fine.number_of_faces() <<
> std::endl;
> std::cout << "Number of vertices: " << cdt_fine.number_of_vertices() <<
> std::endl;
> }
>
>
> This code gives me an CGAL::Assertion_Exception. If I change the value of
> v11 to a more accurate value like -12.429654299747199, it works fine. What
> is happening here? Is this a bug?
>
> My environment:
> VS2008 on WinXP (Service Pack 3)
> CGAL 4.0.2
>
>
> Hope you can help me. Thank you!
> Gert H.
>
>
>
> --
> View this message in context:
> http://cgal-discuss.949826.n4.nabble.com/Delauny-Mesher-gives-a-CGAL-Assert
> ion-exception-tp4655548.html Sent from the cgal-discuss mailing list archive
> at Nabble.com.
--
Laurent Rineau, PhD
R&D Engineer at GeometryFactory http://www.geometryfactory.com/
Release Manager of the CGAL Project http://www.cgal.org/
- [cgal-discuss] Delauny_Mesher gives a CGAL::Assertion_exception, gerth, 07/25/2012
- Re: [cgal-discuss] Delauny_Mesher gives a CGAL::Assertion_exception, Sebastien Loriot (GeometryFactory), 07/25/2012
- Re: [cgal-discuss] Delauny_Mesher gives a CGAL::Assertion_exception, Laurent Rineau (CGAL/GeometryFactory), 07/25/2012
Archive powered by MHonArc 2.6.18.