Opened 5 years ago

Last modified 5 years ago

#13098 new Bugs

geometry::touches return wrong result on two polygons

Reported by: bruno.deligny@… Owned by: Barend Gehrels
Milestone: To Be Determined Component: geometry
Version: Boost 1.63.0 Severity: Problem
Keywords: polygon touches Cc:

Description

touches should returns true:

#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/algorithms/touches.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>

typedef boost::geometry::model::d2::point_xy<float> P;
boost::geometry::model::polygon<P, false, false> polygon1, polygon2;

boost::geometry::append(polygon1, boost::make_tuple(32.0f, -0.00438580196f));
boost::geometry::append(polygon1, boost::make_tuple(32.0f, -4.0f));
boost::geometry::append(polygon1, boost::make_tuple(37.0f, -4.0f));
boost::geometry::append(polygon1, boost::make_tuple(37.0f, -0.00438580057f));

boost::geometry::append(polygon2, boost::make_tuple(32.0f, 20.0f));
boost::geometry::append(polygon2, boost::make_tuple(32.0f, -0.00438580196f));
boost::geometry::append(polygon2, boost::make_tuple(37.0f, -0.00438580057f));
boost::geometry::append(polygon2, boost::make_tuple(43.0f, -0.00438579917f));
boost::geometry::append(polygon2, boost::make_tuple(43.0f, 20.0f));

assert(boost::geometry::touches(polygon1, polygon2) == true);

Change History (1)

comment:1 by anonymous, 5 years ago

Again with another test case

typedef boost::geometry::model::d2::point_xy<float> P;
boost::geometry::model::polygon<P, false, false> polygon1, polygon2;

boost::geometry::append(polygon1, boost::make_tuple(-4.483882904052734375,-4.51576709747314453125));
boost::geometry::append(polygon1, boost::make_tuple(-4.483882904052734375,-0.747307300567626953125));
boost::geometry::append(polygon1, boost::make_tuple(-8.14855480194091796875,-0.747307300567626953125));
boost::geometry::append(polygon1, boost::make_tuple(-8.14855480194091796875,-4.51576709747314453125));

boost::geometry::append(polygon2, boost::make_tuple(-4.483882904052734375,-4.51576709747314453125));
boost::geometry::append(polygon2, boost::make_tuple(-8.14855480194091796875,-4.51576709747314453125));
boost::geometry::append(polygon2, boost::make_tuple(-8.14855480194091796875,-0.747307300567626953125));
boost::geometry::append(polygon2, boost::make_tuple(-4.483882904052734375,-0.747307300567626953125));
boost::geometry::append(polygon2, boost::make_tuple(-3.029389858245849609375,-0.74730741977691650390625));
boost::geometry::append(polygon2, boost::make_tuple(-14.33083057403564453125,0.830356121063232421875));
boost::geometry::append(polygon2, boost::make_tuple(-14.33083057403564453125,-5.412969112396240234375));

assert(boost::geometry::touches(polygon1, polygon2) == true);
Note: See TracTickets for help on using tickets.