使用 Clipper 库 - Angus Johnson =>无法运行代码片段

发布于 2025-01-04 21:01:48 字数 1238 浏览 1 评论 0原文

我正在尝试使用 Clipper 库来扩展避障机器人控制任务中的障碍物图像。 但现在,我什至坚持使用库的示例代码:

(http://www.angusj.com/delphi/clipper.php#code)

包含“clipper.hpp”

//from clipper.hpp ...
//typedef signed long long long64;
//struct IntPoint {long64 X; long64 Y;};
//typedef std::vector<IntPoint> Polygon;
//typedef std::vector<Polygon> Polygons;
...
using namespace ClipperLib;

Polygons subj(2), clip(1), solution;

subj[0].push_back(IntPoint(180,200));
subj[0].push_back(IntPoint(260,200));
subj[0].push_back(IntPoint(260,150));
subj[0].push_back(IntPoint(180,150));

subj[1].push_back(IntPoint(215,160));
subj[1].push_back(IntPoint(230,190));
subj[1].push_back(IntPoint(200,190));

clip[0].push_back(IntPoint(190,210));
clip[0].push_back(IntPoint(240,210));
clip[0].push_back(IntPoint(240,130));
clip[0].push_back(IntPoint(190,130));

DrawPolygons(subj, 0x160000FF, 0x600000FF);  // <- identifier not found
DrawPolygons(clip, 0x20FFFF00, 0x30FF0000);  // <- identifier not found

Clipper c;
c.AddPolygons(subject, ptSubject);
c.AddPolygons(clip, ptClip);
if (c.Execute(ctIntersection, solution)
  DrawPolygons(solution, 0x3000FF00, 0xFF006600);

我想知道我是否缺少任何库安装?我知道这是一个小问题,而且我有点新手,但任何帮助都可以减轻我的很多工作。谢谢你!

I'm trying to use Clipper library to expand the obstacle images in my obstacle avoidance robot control assignment.
But now, I'm even stuck with the example code of the library:

(http://www.angusj.com/delphi/clipper.php#code)

include "clipper.hpp"

//from clipper.hpp ...
//typedef signed long long long64;
//struct IntPoint {long64 X; long64 Y;};
//typedef std::vector<IntPoint> Polygon;
//typedef std::vector<Polygon> Polygons;
...
using namespace ClipperLib;

Polygons subj(2), clip(1), solution;

subj[0].push_back(IntPoint(180,200));
subj[0].push_back(IntPoint(260,200));
subj[0].push_back(IntPoint(260,150));
subj[0].push_back(IntPoint(180,150));

subj[1].push_back(IntPoint(215,160));
subj[1].push_back(IntPoint(230,190));
subj[1].push_back(IntPoint(200,190));

clip[0].push_back(IntPoint(190,210));
clip[0].push_back(IntPoint(240,210));
clip[0].push_back(IntPoint(240,130));
clip[0].push_back(IntPoint(190,130));

DrawPolygons(subj, 0x160000FF, 0x600000FF);  // <- identifier not found
DrawPolygons(clip, 0x20FFFF00, 0x30FF0000);  // <- identifier not found

Clipper c;
c.AddPolygons(subject, ptSubject);
c.AddPolygons(clip, ptClip);
if (c.Execute(ctIntersection, solution)
  DrawPolygons(solution, 0x3000FF00, 0xFF006600);

I'm wondering if I'm lack of any library installation? I know this is a small question and I'm a bit of a novic but any help can ease a lot of my work. Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

难理解 2025-01-11 21:01:48

我想知道我是否缺少任何库安装?

不,你不缺少任何图书馆。 “DrawPolygons”函数只是您自己的代码的占位符。如何实现多边形绘制将取决于您打算使用的图形库(如果有)(例如 GDI+、OpenGL、Cairo、AGG 等)。

(Clipper 包附带了大量已编译的示例,演示如何将 Clipper 与上述每个图形渲染库一起使用。)

I'm wondering if I'm lack of any library installation?

No, you're not lacking any library. The 'DrawPolygons' function is simply a placeholder for your own code. How you implement the drawing of polygons will depend on the graphics library you intend to use, if any (eg GDI+, OpenGL, Cairo, AGG etc).

(The Clipper package comes with numerous compiled examples that demonstrate how to use Clipper with each of the graphics rendering libraries mentioned above.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文