Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Re: Bug with do_intersect?

Subject: CGAL users discussion list

List archive

[cgal-discuss] Re: Bug with do_intersect?


Chronological Thread 
  • From: goshhukha <>
  • To:
  • Subject: [cgal-discuss] Re: Bug with do_intersect?
  • Date: Tue, 13 Nov 2012 23:33:40 -0800 (PST)

I see, Stefan.

So let's say if I want to check whether any two or more of the polygon inside of polygon list do intersect ( in the sense that they have overlapping area, not sharing edges or sharing points), which method I should use? 

I want the method to be a fast one, thus, I want the method be able to use something like inexact construction exact predicate thing. If possible. 


On Wed, Nov 14, 2012 at 3:29 PM, Stefan Schirra [via cgal-discuss] <[hidden email]> wrote:
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/Exact_predicates_exact_constructions_kernel.h>
> #include <CGAL/Boolean_set_operations_2.h>
>
> typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
> 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 (13368240.604, -23133412.8));
>    P.push_back (Point_2 (13364140.624, -23133192.28));
>      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 (13375139.672, -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));
>    Q.push_back(Point_2 (13374018.867, -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





If you reply to this email, your message will be added to the discussion below:
http://cgal-discuss.949826.n4.nabble.com/Bug-with-do-intersect-tp4656236p4656238.html
To unsubscribe from Bug with do_intersect?, click here.
NAML



View this message in context: Re: Bug with do_intersect?
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.18.

Top of Page