boost: boost::geometry::intersection produces wrong result

Hi everyone. I've just noticed unit test which produced correct result on boost 1.55, but it fails on 1.67
Is that known? No matter if clippingRegion is defined in CW or CCW direction, it always gives me 2 lines as a result of intersection. But with the same input old boost gave me 1 (but very small) correct subsegment as a result.

Could you please help with that?

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
using namespace boost::geometry::model;
using namespace boost::geometry;

typedef d2::point_xy<double>				BoostPoint;
typedef polygon<BoostPoint >				BoostPolygon;
typedef linestring<BoostPoint>				BoostPolyline;

int main(void)
{
	BoostPolyline polyToClip;
	std::vector<BoostPolyline> clippingResult;

	polyToClip.push_back(BoostPoint(-7.7866132709658586e-005, 6.0810736257569502));
	polyToClip.push_back(BoostPoint(-7.7866132709658586e-005, -6.0811651098339610));


	multi_polygon<BoostPolygon> clippingRegion;
	BoostPolygon curPolygon;
	append(curPolygon, BoostPoint(0.084821928797522289, 1.9999244955432876));
	append(curPolygon, BoostPoint(1.8813618198054716e-016, 2.0001895226089994));
	append(curPolygon, BoostPoint(-7.7866133709978802e-005, 1.9997988605928652));
	append(curPolygon, BoostPoint(0.00000000000000000, 1.9994081985767305));
	append(curPolygon, BoostPoint(0.00000000000000000, -2.0001895226089998));
	append(curPolygon, BoostPoint(0.084821928797522289, 1.9999244955432876));
	clippingRegion.push_back(curPolygon);
	reverse(clippingRegion);

	intersection(clippingRegion, polyToClip, clippingResult);
	return 0;
}

Here you can see how polyToClip (red and pink) gets separated by point 2 of clippingRegion (green). But even If I change direction of clippingRegion - it still produces the same result.

imagehttps://github.com/boostorg/geometry/issues/510

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值