Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Triangle_2 intersection throws exception
- Date: Tue, 06 Mar 2012 14:03:05 +0100
Read this:
http://www.cgal.org/FAQ.html#inexact_NT
and then use Exact_predicates_exact_constructions_kernel
Sebastien.
On 03/06/2012 02:05 PM, Miguel Oliveira wrote:
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
<http://cgal-discuss.949826.n4.nabble.com/Triangle-2-intersection-throws-exception-tp4449736p4449736.html>
Triangle_2 intersection throws exception
<http://cgal-discuss.949826.n4.nabble.com/Triangle-2-intersection-throws-exception-tp4449736p4449736.html>
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_2type 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
<http://cgal-discuss.949826.n4.nabble.com/Triangle-2-intersection-throws-exception-tp4449736p4449736.html>
Sent from the cgal-discuss mailing list archive
<http://cgal-discuss.949826.n4.nabble.com/> at Nabble.com.
- [cgal-discuss] Triangle_2 intersection throws exception, mriem, 03/06/2012
- Re: [cgal-discuss] Triangle_2 intersection throws exception, Miguel Oliveira, 03/06/2012
- Re: [cgal-discuss] Triangle_2 intersection throws exception, Sebastien Loriot (GeometryFactory), 03/06/2012
- [cgal-discuss] Re: Triangle_2 intersection throws exception, mriem, 03/06/2012
- Re: [cgal-discuss] Re: Triangle_2 intersection throws exception, Sebastien Loriot (GeometryFactory), 03/06/2012
- Re: [cgal-discuss] Re: Triangle_2 intersection throws exception, Miguel Oliveira, 03/06/2012
- Re: [cgal-discuss] Re: Triangle_2 intersection throws exception, Sebastien Loriot (GeometryFactory), 03/06/2012
- [cgal-discuss] Re: Triangle_2 intersection throws exception, mriem, 03/09/2012
- Re: [cgal-discuss] Re: Triangle_2 intersection throws exception, Sebastien Loriot (GeometryFactory), 03/06/2012
- Re: [cgal-discuss] Re: Triangle_2 intersection throws exception, Miguel Oliveira, 03/06/2012
- Re: [cgal-discuss] Re: Triangle_2 intersection throws exception, Sebastien Loriot (GeometryFactory), 03/06/2012
- [cgal-discuss] Re: Triangle_2 intersection throws exception, mriem, 03/06/2012
- Re: [cgal-discuss] Triangle_2 intersection throws exception, Sebastien Loriot (GeometryFactory), 03/06/2012
- Re: [cgal-discuss] Triangle_2 intersection throws exception, Miguel Oliveira, 03/06/2012
Archive powered by MHonArc 2.6.16.