跳转到主要内容

路径上的布尔操作。

项目描述

Build Status PyPI Python Versions

布尔运算

路径上的布尔运算,使用 Angus Johnson 开发的超快速 多边形裁剪库

您可以从 PyPI 下载最新版本

https://pypi.ac.cn/project/booleanOperations.

安装

Pip 是安装 booleanOperations 推荐的工具。

要安装最新版本

pip install booleanOperations

BooleanOperations 依赖于以下包

所有依赖项均可在 PyPI 上找到,因此它们将在安装 booleanOperations 时自动解决。

BooleanOperationManager

包含一个处理路径上所有布尔运算的 BooleanOperationManager。路径必须类似于 defconrobofab 外轮廓。管理器在 pointPen 中绘制结果。

from booleanOperations import BooleanOperationManager

manager = BooleanOperationManager()

BooleanOperationManager()

创建一个 BooleanOperationManager

manager.union(contours, pointPen)

对所有 contours 执行并集并在 pointPen 中绘制它。(这是移除重叠的操作)

manager.difference(contours, clipContours, pointPen)

contours 中移除 clipContours 并在 pointPen 中绘制它。

manager.intersection(contours, clipContours, pointPen)

仅从 contoursclipContours 的重叠部分绘制并绘制在 pointPen 中。

manager.xor(contours, clipContours, pointPen)

仅从 contoursclipContours 不重叠的部分绘制并绘制在 pointPen 中。

manager.getIntersections(contours)

返回给定轮廓的所有交集

BooleanGlyph

具有布尔功能的类似符号的对象。

from booleanOperations.booleanGlyph import BooleanGlyph

booleanGlyph = BooleanGlyph(sourceGlyph)

BooleanGlyph(sourceGlyph)

sourceGlyph 创建一个 BooleanGlyph 对象。这是一个非常浅层的符号对象,具有基本支持。

booleanGlyph.union(other)

other 执行 并集。其他必须是符号或 BooleanGlyph 对象。

result = BooleanGlyph(glyph).union(BooleanGlyph(glyph2))
result = BooleanGlyph(glyph) | BooleanGlyph(glyph2)
booleanGlyph.difference(other)

other 执行 差集。其他必须是符号或 BooleanGlyph 对象。

result = BooleanGlyph(glyph).difference(BooleanGlyph(glyph2))
result = BooleanGlyph(glyph) % BooleanGlyph(glyph2)
booleanGlyph.intersection(other)

other 执行 交集。其他必须是符号或 BooleanGlyph 对象。

result = BooleanGlyph(glyph).intersection(BooleanGlyph(glyph2))
result = BooleanGlyph(glyph) & BooleanGlyph(glyph2)
booleanGlyph.xor(other)

other 执行 对称差集。其他必须是符号或 BooleanGlyph 对象。

result = BooleanGlyph(glyph).xor(BooleanGlyph(glyph2))
result = BooleanGlyph(glyph) ^ BooleanGlyph(glyph2)
booleanGlyph.removeOverlap()

对自己执行 并集。这将移除所有重叠轮廓和自相交轮廓。

result = BooleanGlyph(glyph).removeOverlap()

booleanGlyph.name

源符号的 名称

booleanGlyph.unicodes

源符号的 Unicode

booleanGlyph.width

源符号的 宽度

booleanGlyph.lib

源符号的

booleanGlyph.note

源符号的 备注

booleanGlyph.contours

列出符号的 轮廓

booleanGlyph.components

列出符号的 组件

booleanGlyph.anchors

列出符号的 锚点

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

booleanOperations-0.9.0.zip (202.9 kB 查看哈希)

上传时间 源代码

构建分发

booleanOperations-0.9.0-py3-none-any.whl (18.5 kB 查看哈希)

上传时间 Python 3

支持者