Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Triangle_2 intersection throws exception

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Triangle_2 intersection throws exception


Chronological Thread 
  • From: Miguel Oliveira <>
  • To:
  • Subject: Re: [cgal-discuss] Triangle_2 intersection throws exception
  • Date: Tue, 06 Mar 2012 13:05:27 +0000

Hello

I am sorry I think my previous post is a bit messy :)

I was editing and somehow I cut off the carriage returns.

Anyway, I corrected the message on the online forum  so if anyone can help please go to

Triangle_2 intersection throws exception

There you can easily read it

Thanks

Miguel

On 03/06/2012 12:47 PM, mriem wrote:
Hi I am doing triangle intersection for the creation of a mesh. I use the cgal intersection at http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Kernel_23_ref/Function_intersection.html my objects are of cgal::triangle_2 type and the kernel is typedef CGAL::Exact_predicates_inexact_constructions_kernel K; The code is like this: //tx_py are the triangle points where x is the triangle number and y the triangle vertice number CGAL::Triangle_2* t0; //triangle t0 CGAL::Triangle_2* t1; //triangle t1 //make sure the triangles are built in ccw orientation if ((CGAL::Triangle_2(t0_p0, t0_p1, t0_p2)).orientation()>0) t0 = new CGAL::Triangle_2(t0_p0, t0_p1, t0_p2); else t0 = new CGAL::Triangle_2(t0_p0, t0_p2, t0_p1); //make sure the triangles are built in ccw orientation if ((CGAL::Triangle_2(t1_p0, t1_p1, t1_p2)).orientation()>0) t1 = new CGAL::Triangle_2(t1_p0, t1_p1, t1_p2); else t1 = new CGAL::Triangle_2(t1_p0, t1_p2, t1_p1); CGAL::Object result = CGAL::intersection(*t0, *t1); //sometimes this line throws an exception I do literally thounsands of intersections without any problem. However, in some particular cases the intersection throws an exception. I cannot understand why it does. I make sue both triangles are ccw oriented, just in case, and I know they are not degenerate. Heres the case where an exception occurs: //coordinates of the triangle t0 x1 = [3.902000 2.924000 2.917000] y1= [0.769000 0.099000 -0.002000] //coordinates of the triangle t1 x2 = [2.917000 4.006000 3.902000] y2= [-0.002000 0.765000 0.769000] Here they are drawed with the vertices indicated triangle_intr_problem The exception is terminate called after throwing an instance of 'CGAL::Assertion_exception' what(): CGAL ERROR: assertion violation! Expr: add <= 2 File: /usr/include/CGAL/Intersections_2/Triangle_2_Triangle_2_intersection_impl.h Line: 129 Any idea why this happens? Thank you very much Miguel

View this message in context: Triangle_2 intersection throws exception
Sent from the cgal-discuss mailing list archive at Nabble.com.




Archive powered by MHonArc 2.6.16.

Top of Page