小编sai*_*tej的帖子

使用 Clipper 库 (c++) 进行线和多边形裁剪返回空路径

我正在尝试使用 Clipper 库按线分割多边形。执行裁剪后,返回空路径。有人可以建议正确的方法来做同样的事情吗?


Paths clip(2),soln;
clip[0] << IntPoint(-264,-210) << IntPoint(650,-209);
Path sub = clip[0];
Path poly << IntPoint(531,49) << IntPoint(-21,49) << IntPoint(-970,-961) << IntPoint(-945,-1019) << IntPoint(1045,-1071) ;
Clipper c;
 c.AddPath(poly,ptSubject,true);
    c.AddPath(sub,ptClip,true);
    c.Execute(ctIntersection,soln,pftNonZero, pftNonZero);
   std::cout << soln.size() << "soln size";
Run Code Online (Sandbox Code Playgroud)

溶液尺寸为零。

c++ clipping clipperlib

2
推荐指数
1
解决办法
1836
查看次数

标签 统计

c++ ×1

clipperlib ×1

clipping ×1