Skip to content

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

Closed
@LeoValque

Description

@LeoValque

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.):

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions