Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] is_line() abort problem

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] is_line() abort problem


Chronological Thread 
  • From: Marco Aurelio Sterpa <>
  • To:
  • Subject: Re: [cgal-discuss] is_line() abort problem
  • Date: Sat, 17 Oct 2009 14:37:55 +0200
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=oFNzqBi+oRpXVedhOHF35NBaNQdYqE+Q177VSI7D+8/JB1nFilBojAbxvm9Qxk0OK1 De6mq4TsOpBYuacdTGDpPhxrY/OPCroXDwi7cEeBX46pNjGPLJ02MXjN4tbxWaEdOoz5 nqrzZl8vIqREZWp4XvgicjgCBKDyRQhzVekGE=

On macbook with ubuntu the program goes good without problems. How can it be?

2009/10/17 Sterpa <>
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
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss




Archive powered by MHonArc 2.6.16.

Top of Page