|
Geometry : |
Subject: [ggl] point on the border and within ?
From: Adam Wulkiewicz (adam.wulkiewicz)
Date: 2011-10-05 12:13:11
2011/10/5 Aleksandar Babic <aleksandarb_at_[hidden]>
>
> Hei,
> I have the following problem - detecting point on the border of ring, The code is like this:
>
> typedef model::d2::point_xy<double> point_2d;
> typedef model::ring<point_2d>??????????? ring_2d;
>
> .....
>
> point_2d p(3.0,2.0);
>
> model::ring<point_2d, true, true> ccRing3;
>
> ccRing3.push_back(point_2d(1.0,1.0));
> ccRing3.push_back(point_2d(1.0,3.0));
> ccRing3.push_back(point_2d(3.0,3.0));
> ccRing3.push_back(point_2d(3.0,1.0));
> ccRing3.push_back(point_2d(1.0,1.0));
>
> cerr << "point within ccRing3(WINDING): " << (within(p, ccRing3) ? "YES":"NO") << endl;
> cerr << "point within ccRing3(FRANKLIN): " << (within(p, ccRing3, strategy::within::franklin<point_2d>()) ? "YES":"NO") << endl;
> cerr << "point within ccRing3(CROSSINGS): " << (within(p, ccRing3, strategy::within::crossings_multiply<point_2d>()) ? "YES":"NO") << endl;
>
> ....
>
> I'm always getting NO.
> Am I doing something wrong .. or this is a bug?
Hi,
within() returns false for borders. You may use covered_by() instead
but it isn't in the official release yet.
You must download it from: http://svn.boost.org/svn/boost/trunk/boost/geometry.
Regards,
Adam
Geometry list run by mateusz at loskot.net