Subject: CGAL users discussion list
List archive
- From: Gert Hutter <>
- To:
- Subject: [cgal-discuss] Delauny_Mesher gives CGAL::Assertion_exception
- Date: Tue, 17 Jul 2012 10:21:14 +0200
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.
- [cgal-discuss] Delauny_Mesher gives CGAL::Assertion_exception, Gert Hutter, 07/17/2012
Archive powered by MHonArc 2.6.18.