Subject: CGAL users discussion list
List archive
- From: Sterpa <>
- To:
- Subject: [cgal-discuss] is_line() abort problem
- Date: Sat, 17 Oct 2009 12:43:03 +0200 (CEST)
I write a code to extract the k-level of an arrangement in the plane. This is
a
simple code to know the level of a given halfedge, but I got an error trying
to
access e.curve().line(), am I doing something wrong?
int getLevel(Halfedge e, vector<Line_2> lines) {
int level = 0;
NT x;
bool source_finite, target_finite;
if(e.direction() == CGAL::ARR_RIGHT_TO_LEFT) e = *e.twin();
source_finite = !e.source()->is_at_open_boundary();
target_finite = !e.target()->is_at_open_boundary();
if(source_finite) {
if(target_finite) x = CGAL::midpoint(e.source()->point(),
e.target()->point()).x();
else x = e.source()->point().x() + 1;
}
else if(target_finite) x = e.target()->point().x() - 1;
else x = 0;
Line_2 l = Line_2(-1, 0, x);
Point_2 p = intersection(e.curve().line(), l);
for(unsigned i = 0; i < lines.size(); i++) {
Point_2 tmp = intersection(l, lines[i]);
if(p.y() > tmp.y()) level++;
}
return level;
}
terminate called after throwing an instance of 'CGAL::Precondition_exception'
what(): CGAL ERROR: precondition violation!
Expr: is_line()
File: /usr/local/include/CGAL/Arr_linear_traits_2.h
Line: 1700
I really need to fix this in short time, so thanks in advance to anyone. Best
regards
- [cgal-discuss] is_line() abort problem, Sterpa, 10/17/2009
- Re: [cgal-discuss] is_line() abort problem, Marco Aurelio Sterpa, 10/17/2009
Archive powered by MHonArc 2.6.16.