[Boost-users] [geometry] intersects bug?

47 views
Skip to first unread message

Akira Takahashi

unread,
Jul 26, 2011, 9:17:05 PM7/26/11
to boost...@lists.boost.org
Hi,

I try boost::geometry::intersects algorithm(1 arg version) in Boost 1.47.0.
Follow program result is "false". but, I hope result is "true".
Is this Boost.Geometry bug?

#include <iostream>
#include <boost/assign/list_of.hpp>
#include <boost/geometry/geometry.hpp>

namespace bg = boost::geometry;

int main()
{
typedef bg::model::d2::point_xy<double> point;

const bg::model::linestring<point> line = boost::assign::list_of<point>
// (0, 0) // result become "true" when comment-in
(0, 4)
(4, 4)
(2, 2)
(2, 5)
;

const bool result = bg::intersects(line);
std::cout << std::boolalpha << result << std::endl;
}

Regards,

>>========================
Akira Takahashi
mailto:faitha...@gmail.com
blog: http://d.hatena.ne.jp/faith_and_brave/

line.png

Barend Gehrels

unread,
Jul 27, 2011, 5:27:42 PM7/27/11
to boost...@lists.boost.org
Hi Akira,

> Hi,
>
> I try boost::geometry::intersects algorithm(1 arg version) in Boost 1.47.0.
> Follow program result is "false". but, I hope result is "true".

It certainly should return true.

> Is this Boost.Geometry bug?

Will look at this next weekend.

Thanks for the report,
Barend

_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Barend Gehrels

unread,
Jul 28, 2011, 5:00:50 PM7/28/11
to boost...@lists.boost.org
Hi Akira,


On 27-7-2011 3:17, Akira Takahashi wrote:
> Hi,
>
> I try boost::geometry::intersects algorithm(1 arg version) in Boost 1.47.0.
> Follow program result is "false". but, I hope result is "true".
> Is this Boost.Geometry bug?

It is fixed (in Trunk), thanks for the report.

What was happening is that it detected that first/last segment
intersected, which is possible for a linestring (but skipped for a
closed ring). I added a unit test for this case.

Regards, Barend

Akira Takahashi

unread,
Jul 28, 2011, 11:24:40 PM7/28/11
to boost...@lists.boost.org
Hi Barend

> It is fixed (in Trunk), thanks for the report.

I confirmed fix.
Thanks!

>>========================
Akira Takahashi
mailto:faitha...@gmail.com
blog: http://d.hatena.ne.jp/faith_and_brave/

Reply all
Reply to author
Forward
0 new messages