Boost logo

Geometry :

Subject: [ggl] point on the border and within ?
From: Aleksandar Babic (aleksandarb)
Date: 2011-10-05 12:21:10


Hei Adam,

Many thanks. Will certainly take the latest code from repository.

It also occurred to me (and some tests are proving it) that one might
check the following:

if( !within(point, ring) && distance(point, ring) == 0)
    cerr<< "point must be on the border"<<endl;

What do you think?

Similarly one could use the distance to check if point lies on the
line / segment.

Please correct me if my thinking is wrong.

Br
Aleksandar

On Wed, 2011-10-05 at 16:33 +0200, Adam Wulkiewicz wrote:

> 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
> _______________________________________________
> ggl mailing list
> ggl_at_[hidden]
> http://lists.osgeo.org/mailman/listinfo/ggl

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/ggl/attachments/20111005/106f4adc/attachment.html


Geometry list run by mateusz at loskot.net