Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Bug in Triangle_3-Triangle_3 intersection?

Subject: CGAL users discussion list

List archive

[cgal-discuss] Bug in Triangle_3-Triangle_3 intersection?


Chronological Thread 
  • From: Rostislav Khlebnikov <>
  • To: <>
  • Subject: [cgal-discuss] Bug in Triangle_3-Triangle_3 intersection?
  • Date: Sun, 20 Jul 2014 19:22:08 +0100

Hello guys,

I'm having the intersection procedure not returning correct results for triangle-triangle intersection in 3D. I have compile a minimal example that shows the problem:

-----------------------------------------------------------------
#include <CGAL/Simple_cartesian.h>

typedef CGAL::Simple_cartesian<double> K;
typedef K::FT FT;
typedef K::Point_3 Point;
typedef K::Triangle_3 Triangle;
typedef K::Segment_3 Segment;


void main()
{
Triangle tri1 (Point(6.7910000000, -1.09375, -0.900025), Point(6.791, 18.9, -0.9), Point(6.791, -1.09375, 144.321));
Triangle tri1a(Point(6.7910000001, -1.09375, -0.900025), Point(6.791, 18.9, -0.9), Point(6.791, -1.09375, 144.321));

Triangle tri2(Point(7.8, 5.6, 6.7269), Point(5.9, 1.7, 45.955), Point(7.9, 13.2, 45.893));

std::cout << CGAL::intersection(tri1, tri2) << " " << CGAL::intersection(tri1a, tri2);
}
-----------------------------------------------------------------

The output of this code is "0 1" which is quite strange. Do you think it is a bug for some special case or is it the floating-point problem? The thing is - I don't feel like the values are big or small enough for "double" to be insufficient. Is there anything I can do to fix this problem without changing to Exact_predicates_exact_constructions_kernel? I would really like to avoid this - I need performance over accuracy - but I feel that in this case the accuracy is far off what one would expect. I could even detect this special case and add 1e-8 or whateve to one of the points - it just feels weird and looks like a bug to me.

CGAL installation info:
Windows 8.1, MSVS 2013, x64
CGAL 4.4 installed with the CGAL-4.4-Setup.exe installer and then built with CMake and MSVS 2013.

All best,
Rostislav.



Archive powered by MHonArc 2.6.18.

Top of Page