Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Intersection not being detected

Subject: CGAL users discussion list

List archive

[cgal-discuss] Intersection not being detected


Chronological Thread 
  • From: breenmachine <>
  • To:
  • Subject: [cgal-discuss] Intersection not being detected
  • Date: Fri, 5 Feb 2010 10:55:25 -0800 (PST)


Hi, I've been debugging some code for a few hours now and finally have the
problem boiled down to the fact that there is an intersection between 2
polygons that is not being detected. I have a feeling I've done something
stupid or misunderstood the do_intersect() function.

Here is a quick example program that reproduces the problem I'm having. I
know these polygons intersect because my original program draws them and the
intersection is quite large. Does anyone know why do_intersect is returning
0? Thanks.

#include <CGAL/Boolean_set_operations_2.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
using namespace std;
typedef CGAL::Exact_predicates_inexact_constructions_kernel Rep;
typedef CGAL::Point_2<Rep> Point_2;
typedef CGAL::Polygon_2<Rep> Polygon_2;

int main()
{
Point_2 box[5] = {Point_2(1.775,3.925), Point_2(-4.075,3.925),
Point_2(-4.075,9.725), Point_2(1.775,9.725)};
Polygon_2 boxPoly = Polygon_2(box,box+4);
Point_2 quad[5] = {Point_2(2.69,4.7), Point_2(0.91,2.4),
Point_2(0.21,3.4), Point_2(1.75,5)};
Polygon_2 quadPoly = Polygon_2(quad,quad+4);
cout << do_intersect(quadPoly,boxPoly) << endl;
}


--
View this message in context:
http://n4.nabble.com/Intersection-not-being-detected-tp1470645p1470645.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.16.

Top of Page