我在boost :: geometry中有多個多邊形,並且想從一個與第一個多邊形具有最長公共邊界的多邊形中找到特定的鄰居。多邊形正好互相接觸,從而boost::geometry::disjoint
返回false,但下面的代碼總是返回周長0:如何在boost :: geometry中找到2個多邊形的觸摸長度?
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;
我如何才能找到共同的「邊界」,這兩個多邊形的接觸長度是多少?
由於似乎沒有預定義的解決方案,我不得不建立自己的。謝謝你的幫助。好的靈感。 –
@REDSOFTADAIR我很確定我已經用數學方法確定了這一點,是不是值得接受? :-) –
我給了你一個投票。我仍然想知道是否有人直接在boost :: geometry中解決了這個問題。這是我的問題。 –