|
Geometry : |
Subject: Re: [geometry] Call to geometry::within returns true when point is outside ring
From: Rob K. (kashiraja_at_[hidden])
Date: 2012-10-16 03:16:17
Hi Barend,
Thanks. Ah yes, I made the assumption that closed meant that I didn't have
to close explicitly. But it should be set to closed only if first and last
point are indeed the same (
http://www.boost.org/doc/libs/1_51_0/libs/geometry/doc/html/geometry/reference/enumerations/closure_selector.html
).
BTW, I'm getting an awful lot of compiler warnings when compiling under
MSVS2012.
E.g. calling
boost::geometry::disjoint(ring1, ring2); // C4702, C4100, C4127, C4189,
C4512
or
boost::geometry::within<Point, Ring>(point1, ring4); // C4512, C4100
I presume that is something I have to get used to for the compiler I use?
Rob
when:
typedef boost::geometry::model::d2::point_xy<double> Point;
typedef boost::geometry::model::ring<Point, true, false> Ring;
On Sun, Oct 14, 2012 at 10:59 PM, Barend Gehrels <barend_at_[hidden]> wrote:
>
>
>
>
>
> Op 15 okt. 2012 om 01:57 heeft "Rob K." <kashiraja_at_[hidden]> het
> volgende geschreven:
>
> Hi,
> I'm seeing some unexpected behavior in a call to within. In the code below
> I am checking if a coordinate (0,0) is within a ring. The ring is
> positioned to the right of the origin so within should return false, but it
> returns true.
> However, if the ring coordinates conform to a true rectangle (for example,
> all lines are parallel to either X or Y axis), the function returns false
> regardless of where the rectangle is positioned in the Y direction (as
> expected).
>
> Moving the ring along different offsets along the y-axis, it seems if any
> line intersects the x-axis at an angle, it returns true. E.g. in the test
> case below the top line is (4,0) to (6,-.1).
> I've just started using this library so it is possible I have over looked
> some assumption (I have made sure that the coordinates are listed in
> clockwise order at least).
>
> I a post a month or two ago that indicates that ::within might still not
> be fully functional? (<http://boost-geometry.203548.n3.nabble.com/a-ring-concept-implementation-of-a-true-circle-td4025091.html#a4025110>
> http://boost-geometry.203548.n3.nabble.com/a-ring-concept-implementation-of-a-true-circle-td4025091.html#a4025110
> )
>
>
>
> Hi,
>
> Welcome to the list.
>
> The post you mentioned was about circles, which is something different and
> indeed not fully implemented.
>
> Your code uses an unclosed ring, therefore you get unexpected behaviour.
> Please close the ring explicitly, or use geometry::correct, or use the
> definition of an Open Ring.
>
> Regards, Barend
>
>
> Sent from iPad.
> Barend Gehrels
> www.barendgehrels.nl
>
>
>
>
>
> _______________________________________________
> Geometry mailing list
> Geometry_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/geometry
>
>
Geometry list run by mateusz at loskot.net