Subject: CGAL users discussion list
List archive
- From: huanghz <>
- To:
- Subject: [cgal-discuss] Problems when constructing arrangement
- Date: Tue, 4 Jun 2013 19:34:40 -0700 (PDT)
Hi, I am a new user and have some problem when constructing an arrangement
for a Voronoi Diagram.
Firstly, I get a Delaunay Triangulation for some points:
Delaunay dt;
dt.insert(vertices.begin(), vertices.end());
Then, I use its dual graph to get my Voronoi Diagram:
Delaunay::Edge_iterator eit;
std::vector<X_monotone_curve_2> curves;
for( eit = dt.edges_begin(); eit != dt.edges_end(); eit ++)
{
CGAL::Object o = dt.dual(eit);
if (CGAL::object_cast<K::Segment_2>(&o))
{
double p1x =
(double)CGAL::object_cast<K::Segment_2>(&o)->source().hx();
double p1y =
(double)CGAL::object_cast<K::Segment_2>(&o)->source().hy();
Point p1(p1x, p1y);
double p2x =
(double)CGAL::object_cast<K::Segment_2>(&o)->target().hx();
double p2y =
(double)CGAL::object_cast<K::Segment_2>(&o)->target().hy();
Point p2(p2x, p2y);
const Segment_2 s(p1,p2);
curves.push_back(s);
}
}
But when I do this, there will be an runtime error:
insert(arr, curves.begin(), curves.end());
CGAL error: precondition violation!
Expression : comp_f(object, parentP->object) != SMALLER
File : e:\huanghz\lib\cgal-4.2\include\cgal\multiset.h
Line : 2129
Explanation:
Refer to the bug-reporting instructions at
http://www.cgal.org/bug_report.html
My kernel and traits are defined as follow:
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Arr_linear_traits_2<K> Traits_2;
typedef CGAL::Delaunay_triangulation_2<K> Delaunay;
typedef Traits_2::Point_2 Point;
typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2;
typedef Traits_2::Segment_2 Segment_2;
typedef Traits_2::Ray_2 Ray_2;
typedef Traits_2::Line_2 Line_2;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
typedef Arrangement_2::Vertex_handle Vertex_handle;
typedef Arrangement_2::Halfedge_handle Halfedge_handle;
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Problems-when-constructing-arrangement-tp4657652.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Problems when constructing arrangement, huanghz, 06/05/2013
- <Possible follow-up(s)>
- [cgal-discuss] Problems when constructing arrangement, huanghz, 06/05/2013
Archive powered by MHonArc 2.6.18.