I have a number of polygons in boost::geometry and want to find the specific neighbor from one polygon who has the longest common border with the first polygon. The polygons exactly touch each other so boost::geometry::disjoint
returns false, but the following code always returns perimeter 0:
typedef boost::geometry::model::d2::point_xy<double> boost_pnt;
typedef boost::geometry::model::polygon<boost_pnt> boost_poly;
boost_poly otherPol = ...;
boost_poly thisPol = ...;
if(! boost::geometry::intersection(thisPol, otherPol, out))
return -1;
float perimeter = 0;
BOOST_FOREACH(boost_poly const& p, out)
{
perimeter += boost::geometry::perimeter(p);
}
return perimeter;
How can i find the common "border", the touching length of both polygons?