cgal icon indicating copy to clipboard operation
cgal copied to clipboard

Wrong result for do_intersect between a segment and a triangle if segment degenerate

Open LeoValque opened this issue 1 year ago • 0 comments

Issue Details

The do_intersect function returns the wrong result between a segment and a triangle if the segment is degenerate. I tried it on my colleague's machine to make sure the error didn't come from mine. The expected result is "000" or a precondition violation and the output is "010". A precondition is probably missing.

Source Code

#include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <CGAL/intersections.h>

typedef CGAL::Exact_predicates_exact_constructions_kernel K; typedef K::Point_2 Point_2; typedef K::Triangle_2 Triangle_2; typedef K::Segment_2 Segment_2;

int main(){ Triangle_2 tr_normal(Point_2(-1,0),Point_2(0,0),Point_2(1,7)); Point_2 p(0.5,-1);

Segment_2 seg_normal(p,Point_2(0.5,2));
Segment_2 seg_deg(p,p);

std::cout << CGAL::do_intersect(tr_normal,seg_normal)<< std::endl;
std::cout << CGAL::do_intersect(tr_normal,seg_deg)<< std::endl;
std::cout << CGAL::do_intersect(tr_normal,p)<< std::endl;
return 0;

}

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits): Linux 64bits
  • Compiler: gcc
  • Release or debug mode: both
  • Specific flags used (if any):
  • CGAL version: master
  • Boost version:1.71.0
  • Other libraries versions if used (Eigen, TBB, etc.):

LeoValque avatar Apr 16 '24 09:04 LeoValque