C++ C# Delphi 计算区域 合并 相交等
此库有 C++, C#,Delphi 版本,都比较好用。在区域计算中,有时候需要区域的合并,相交,差值等需求。这里推荐一个 Clipper2 库, 可以快速高效实现。
·
在区域计算中,有时候需要区域的合并,相交,差值等需求。
这里推荐一个 Clipper2 库, 可以快速高效实现
AngusJohnson/Clipper2: Polygon Clipping and Offsetting - C++, C# and Delphi (github.com)
此库有 C++, C#, Delphi 版本,都比较好用。
//C++
Paths64 subject, clip, solution;
subject.push_back(MakePath("100, 50, 10, 79, 65, 2, 65, 98, 10, 21"));
clip.push_back(MakePath("98, 63, 4, 68, 77, 8, 52, 100, 19, 12"));
solution = Intersect(subject, clip, FillRule::NonZero);
//C#
Paths64 subj = new Paths64();
Paths64 clip = new Paths64();
subj.Add(Clipper.MakePath(new int[] { 100, 50, 10, 79, 65, 2, 65, 98, 10, 21 }));
clip.Add(Clipper.MakePath(new int[] { 98, 63, 4, 68, 77, 8, 52, 100, 19, 12 }));
Paths64 solution = Clipper.Intersect(subj, clip, FillRule.NonZero);
//Delphi
var
subject, clip, solution: TPaths64;
begin
SetLength(subject, 1);
subject[0] := MakePath([100, 50, 10, 79, 65, 2, 65, 98, 10, 21]);
SetLength(clip, 1);
clip[0] := MakePath([98, 63, 4, 68, 77, 8, 52, 100, 19, 12]);
solution := Intersect( subject, clip, frNonZero);

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐
所有评论(0)