寻找具有特定功能的多边形几何库
我正在对用 Objective C、C 或 C++(按优先顺序)实现的多边形/几何算法库进行调查。我有非常具体的需求,所以我想我应该向社区询问是否有人知道可以满足部分或全部需求的库/API,因为我更喜欢使用一个库/API 来满足我的所有需求。这就是我需要做的:
- 2 个多边形的交集
- 确定两个多边形是否全等(即形状和大小相同,尽管它们可以旋转或镜像)
- 凸多边形的 2d 装箱(又名片材切割 - 或打开 -结束了装箱,所以我最大限度地使用固定宽度的材料)
- 与#3相同,但对于凹多边形
- 能够采用一组线段,其中一些共享端点,一些与每个端点相交其他并将其变成一组多边形
- 与#5相同,但增加了检测带孔多边形并将其分成2个多边形(至少其中一个是凹形)的
- 能力由直线和曲线组成
这些按优先级顺序排列,我可以在没有它们的情况下解决(我的应用程序变得不太有用)。例如,如果我有一个只执行 1 和 2 的库,我会发现它比执行 3-7 的库更有用。
I am doing a survey of polygon/geometric algorithm libraries implemented in Objective C, C or C++ (in that order of preference). I have very specific needs, so I figured I'd ask the community to see if anyone knows of one that meets some or all of them since I'd prefer to use one library/API for all my needs. This is what I need to be able to do:
- Intersection of 2 polygons
- Determine if two polygons are congruent (i.e. the same shape and size though they may be rotated or mirrored)
- 2d bin packing of convex polygons (aka sheet cutting - or open-ended bin packing so I'm maximizing the use of a run of material of fixed width)
- Same as #3 but for concave polygons
- The ability to take a set of line segments, some of which share endpoints and some of which intersect each other and turn it into a set of polygon
- Same as #5 but with the added ability to detect polygons with holes and break it into 2 polygons (at least one of which would be concave)
- Bonus: any or all of the above with closed shapes that consist of lines and curves
These are in the order of priority and I can work around the absence of any of them (my application just becomes less useful). so for example, if I had a library that only did 1 and 2, I would find that more useful than one that did 3-7.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 C++ 中,存在一些用于处理多边形几何的库,但我不知道完全符合您的需求的库。
我所知道的 C++ 中一个非常有用的库是 CGAL。它满足您的部分需求,但不是全部。
In C++ it exists some libraries to work with the polygon geometry but I don't know one that fully corresponds to your needs.
A very useful library that I know in C++ is CGAL. It covers some of your needs, but not all.
GEOS 涵盖了您需要的一些内容。
GEOS 很好地实现了几何图形之间的空间关系(相交、接触、重叠、在内部、包含等)。
我不知道 3-7 是否是内置的(你可以进行行合并(5))。
至于 7,GEOS 不对曲线建模(仅对形成直线或多边形的点进行建模)。您可以在 GEOS 中定义的唯一闭合形状是多边形。
Some of the things you need are covered by GEOS.
Spatial relations between geometries (intersects, touches, overlaps, is within, contains, etc) are implemented quite nicely by GEOS.
I don't know if 3-7 are built in (you can do line merging (5)).
As for 7, GEOS does not model curves (only points that form lines or polygons). The only closed shapes that you can define in GEOS are polygons.