Subject: CGAL users discussion list
List archive
- From: Efi Fogel <>
- To:
- Subject: Re: [cgal-discuss] Bug with do_intersect?
- Date: Thu, 15 Nov 2012 10:09:43 +0200
Yes.
The do_intersect() of polygons (or polygons with holes) function comes from the "2D Regularized Boolean Set-Operations".
It is consistent with the intersection() function that comes from the same package.
They both perform regularized operations.
The do_intersect() and intersection() functions of kernel objects, such as triangles, are provided by the "2D and 3D Geometry Kernel" package.
It's a bit unfortunate that they all reside in one namespace, namely cgal global namespace, as the latter 2 have different semantics.
We may fix this in the future by either moving the "regularized" functions to a different namespace or renaming them.
The do_intersect() of polygons (or polygons with holes) function comes from the "2D Regularized Boolean Set-Operations".
It is consistent with the intersection() function that comes from the same package.
They both perform regularized operations.
The do_intersect() and intersection() functions of kernel objects, such as triangles, are provided by the "2D and 3D Geometry Kernel" package.
It's a bit unfortunate that they all reside in one namespace, namely cgal global namespace, as the latter 2 have different semantics.
We may fix this in the future by either moving the "regularized" functions to a different namespace or renaming them.
On Wed, Nov 14, 2012 at 6:00 PM, Stefan Schirra <> wrote:
On 14.11.2012 08:34, Ophir Setter wrote:OK, I see, the special case of (General_)Polygon(_with_holes)_2 and the general case of do_intersect(obj1, obj2) are handled differently, for whatever reasons.
I checked the manually the also the "intentions" of the code.
The function do_intersect should return true if the two polygons "intersect in
their interior".
Ophir
So if you intersect triangles (like
Polygon_2 P;
P.push_back (Point_2 (0,0));
P.push_back (Point_2 (1,0));
P.push_back (Point_2 (0,1));
Polygon_2 Q;) as triangles, you get different results?
Q.push_back(Point_2 (1,0));
Q.push_back(Point_2 (1,1));
Q.push_back(Point_2 (0,1));
On Wed, Nov 14, 2012 at 9:28 AM, Stefan Schirra<-magdeburg.de <mailto:-magdeburg.de>> wrote:#include <CGAL/Exact_predicates_exact___constructions_kernel.h>
On 14.11.2012 04:11, Graviton wrote:
I think that there is a bug with the method do_intersect.
Test this sample:
/*! \file do_intersect.cpp
* Determining whether two triangles intersect.
*/
#include <CGAL/Boolean_set_operations___2.h>
typedef CGAL::Exact_predicates_exact___constructions_kernel Kernel;P.push_back (Point_2 (13368240.604 <tel:%2813368240.604>, -23133412.8));
typedef Kernel::Point_2 Point_2;
typedef CGAL::Polygon_2<Kernel> Polygon_2;
#include "print_utils.h"
int main ()
{
Polygon_2 P;
//P.push_back (Point_2 (-1,1));
//P.push_back (Point_2 (0,-1));
//P.push_back (Point_2 (1,1));
P.push_back (Point_2 (13371696.6813195, -23135667.773556));
P.push_back (Point_2 (13364140.624 <tel:%2813364140.624>,
-23133192.28 <tel:23133192.28>));Q.push_back(Point_2 (13375139.672 <tel:%2813375139.672>,
P.push_back (Point_2 (13368823.9405681, -23134726.6078103));
std::cout << "P = "; print_polygon (P);
Polygon_2 Q;
//Q.push_back(Point_2 (-1,-1));
//Q.push_back(Point_2 (1,-1));
//Q.push_back(Point_2 (0,1));Q.push_back(Point_2 (13374018.867 <tel:%2813374018.867>,
-23136795.756));
Q.push_back(Point_2 (13371696.6813195, -23135667.773556));
Q.push_back(Point_2 (13371696.682, -23135667.774));
Q.push_back(Point_2 (13368823.9405681, -23134726.6078103));
Q.push_back(Point_2 (13298835.453, -23111797.193));https://sympa.inria.fr/sympa/__info/cgal-discuss
-23140216.837));
std::cout << "Q = "; print_polygon (Q);
if ((CGAL::do_intersect (P, Q)))
std::cout << "The two polygons intersect in their interior." <<
std::endl;
else
std::cout << "The two polygons do not intersect." << std::endl;
return 0;
}
If you notice carefully, the P and Q are not intersecting each other ( two
points of P and Q are the same, and the other two points of P are located on
the RHS of Q).
But from the above program, the CGAL:do_intersect returns a true. It should
return a false.
A quote from the manual:
"do_intersect(obj1, obj2) checks whether obj1 and obj2 intersect. Two
objects obj1 and obj2 intersect if there is a point p that is part of both
obj1 and obj2..."
So if P and Q have two common points, as you say, true is the correct answer.
best regards
Stefan
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
<https://sympa.inria.fr/sympa/info/cgal-discuss>
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
--
____ _ ____ _
/_____/_) o /__________ __ //
(____ ( ( ( (_/ (_/-(-'_(/
_/
/_____/_) o /__________ __ //
(____ ( ( ( (_/ (_/-(-'_(/
_/
- [cgal-discuss] Bug with do_intersect?, Graviton, 11/14/2012
- Re: [cgal-discuss] Bug with do_intersect?, Ophir Setter, 11/14/2012
- [cgal-discuss] Re: Bug with do_intersect?, goshhukha, 11/14/2012
- Re: [cgal-discuss] Bug with do_intersect?, Stefan Schirra, 11/14/2012
- [cgal-discuss] Re: Bug with do_intersect?, goshhukha, 11/14/2012
- Re: [cgal-discuss] Bug with do_intersect?, Ophir Setter, 11/14/2012
- Re: [cgal-discuss] Bug with do_intersect?, Stefan Schirra, 11/14/2012
- Re: [cgal-discuss] Bug with do_intersect?, Efi Fogel, 11/15/2012
- Re: [cgal-discuss] Bug with do_intersect?, Stefan Schirra, 11/14/2012
- [cgal-discuss] Re: Bug with do_intersect?, goshhukha, 11/14/2012
- Re: [cgal-discuss] Bug with do_intersect?, Ophir Setter, 11/14/2012
Archive powered by MHonArc 2.6.18.