SVG /矢量图形对象布尔运算(并,交,减) [英] SVG / vector graphical objects boolean operations (union, intersection, subtraction)

查看:1895
本文介绍了SVG /矢量图形对象布尔运算(并,交,减)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2D封闭矢量路径,在 SVG指定路径的语法 - 即这些路径包括直线和各种贝塞尔曲线。有没有像一个小的,好的和放任何东西;离散库(preferably在C,Java或Ruby的,但任何语言,如果这个库是干净的,易于使用的都行),允许做这样集,交集和减法这些路径?

I have 2D closed vector paths, specified in SVG paths-like syntax - i.e. these paths include straight lines and various Bezier curves. Is there anything like a small, nice & discrete library (preferably in C, Java or Ruby, but any language will do if this library is clean and easy to use) that allows to do boolean operations like union, intersection and subtraction with these paths?

什么到目前为止,我已经找到了包括:

What I've found so far includes:


  • 巨大而昂贵的商业矢量图形的产品(例如Autodesk AutoCAD或Adobe Illustrator中),可以使用某种API的调用或脚本做布尔2D路径操作 - 这显然是我的目的,矫枉过正

  • Inkscape的内部开发的 lib2geom 库,缺乏文档,绑定,具有一定的编译问题,似乎在Inkscape中,除了本身并没有项目中使用,看起来相当复杂。

  • CGAL 是一个巨大的和pretty复杂的计算几何库,在pretty奇怪的物体空间有效(即你有模板疯狂的搭配,风格势在必行功能上做这些模板的数据结构,等等等等)操作,似乎不具有合理的绑定其他语言ç旁边++。 Python绑定到CGAL似乎放弃,不看对我很友好。

  • JTS 似乎是地理信息系统为中心,只用直线交易,而我需要处理SVG般的贝塞尔曲线。

  • Huge and pricey commercial vector graphic products (such as Autodesk AutoCAD or Adobe Illustrator) that can be called using some sort of API or scripted to do boolean 2D paths operations - which is clearly an overkill for my purposes.
  • Inkscape developed in-house lib2geom library which lacks documentation, bindings, has some compilation issues, seems to be used in no projects besides Inkscape itself and looks fairly complex.
  • CGAL is a huge and pretty complex computational geometry library, that works in pretty weird object space (i.e. you have crazy mix of templates, imperative style functions to do operations on these templated data structures, etc, etc), and doesn't seem to have sane bindings to other languages beside C++. Python bindings to CGAL seem to be abandoned and don't look very friendly to me.
  • JTS seems to be GIS-centred and deals only with straight lines, while I need to deal with SVG-like Bezier curves.

所以,问题是,是否有任何其他的小的,好的和放大器;易库漂浮在SVG样的路径处理布尔操作?

So, the question is, is there are any other small, nice & easy libraries floating around to deal with boolean operations on SVG-like paths?

推荐答案

也许我失去了一些东西,但不会在类中的的java.awt.geom 包满足您的需求?他们处理的二维形状; 专门与布尔运算类处理:

Perhaps I'm missing something, but wouldn't the classes in the java.awt.geom package suit your needs? They deal with two-dimensional shapes; the Area class deals specifically with boolean operations:

这是对象存储和处理的2维空间封闭区域的与分辨率无关的描述。 对象可以转化,并可以执行各种
  建设性的区域几何形状(CAG)操作时与其他对象相结合。该CAG操作包括面积相加,相减,交集和异或。

An Area object stores and manipulates a resolution-independent description of an enclosed area of 2-dimensional space. Area objects can be transformed and can perform various Constructive Area Geometry (CAG) operations when combined with other Area objects. The CAG operations include area addition, subtraction, intersection, and exclusive or.

这篇关于SVG /矢量图形对象布尔运算(并,交,减)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆