Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Re: Bug in Segment Triangle intersection

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Re: Bug in Segment Triangle intersection


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Re: Bug in Segment Triangle intersection
  • Date: Wed, 25 Apr 2012 16:10:08 +0200

Without reading the paper, the two first sentences in the FAQ are enough:

"While it may well be a bug in CGAL, with such number types you are more likely to suffer from a problem with robustness. In particular, using the kernel CGAL::Cartesian with number types double or float is likely to give you wrong results."

So if the result is correct with a kernel with exact constructions, then
the error is due to floating point calculation.

Sebastien.

On 04/25/2012 04:02 PM, gupta61 wrote:
Hi Sebastian,

Thanks for the reply. Actually I did follow your advice and read the
article. Also if you look in my post I mentioned that if I am using exact
constructions, then we get the right result. Also as you have mentioned, if
I use conversion from one kernel to another it gives me correct
intersection.

I just wanted to confirm that this is a problem in "inexact constructions"
and not another bug as we have previously found. My only worry is that the
result is so wrong and different for "segment" and "opposite_segment". I
encountered this kind of error before in BBox and segment intersection and
we realized that the error is because "segment" was considered as a "ray".

If you plot this opposite_segment and triangle, and consider both the things
constructed from rays, you will get the intersection as current output. This
particular assumption still doesn't explain the intersection computed for
segment and triangle.

Regards,
Piyush Gupta


Sebastien Loriot (GeometryFactory) wrote

You did not follow my advice and did not read this:
http://www.cgal.org/FAQ.html#inexact_NT
:)

Note that you can use Cartesian_converter to convert from a kernel
with exact constructions to another kernel.

http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Kernel_23_ref/Class_Cartesian_converter.html

Sebastien.

On 04/24/2012 09:39 PM, gupta61 wrote:
Hi,

We just encountered another bug in CGAL in segment triangle intersection.
I
am trying to find out intersection between the segment and a triangle.

The segment is defined by

CGALSegment3 segment_query( CGALPoint3(2.1, 2, 0.5),
CGALPoint3(3.23135, 2, 0.5) );

and the triangle by

CGALTriangle3 triangle( CGALPoint3(2.18182, 1.81818, 0.666667) /* vertex
0*/,
CGALPoint3(2.18182, 2, 0.5) /* vertex 2*/,
CGALPoint3(2.09091, 1.90909, 0.5833335) /* vertex
3*/

We are using exact predicates and inexact constructions.

The output we are getting is as follows:

Segment query: 2.1 2 0.5 3.23135 2 0.5

Triangle: 2.18182 1.81818 0.666667 2.18182 2 0.5 2.09091 1.90909
0.5833335

CGAL::do_intersect (0/1) = 1

Encountered intersection object is a point (for the segment)
2.1 2 0.5

Encountered intersection object_oppos is a point (for segment.opposite())
1.89801666666667 2 0.5



If we use exact constructions we get the right result. Let me know if I
am
missing anything here.

BTW, the correct result is

Segment query: 2.1 2 0.5 3.23135 2 0.5

Triangle: 2.18182 1.81818 0.666667 2.18182 2 0.5 2.09091 1.90909
0.5833335

CGAL::do_intersect (0/1) = 1

Encountered intersection object is a point
2.18182 2 0.5

Encountered intersection object_oppos is a point
2.18182 2 0.5


-----
Piyush Gupta
UIUC
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Bug-in-Segment-Triangle-intersection-tp4584602p4584602.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss



-----
Piyush Gupta
UIUC
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Bug-in-Segment-Triangle-intersection-tp4584602p4586683.html
Sent from the cgal-discuss mailing list archive at Nabble.com.





Archive powered by MHonArc 2.6.16.

Top of Page