iShape 是一个紧凑且高效的库,专门用于使用 FixVec 表示 2D 数据结构。
使用 Swift Package Manager 安装 iShape 既简单又容易。 只需按照以下步骤操作
https://github.com/iShape-Swift/iShape
import iFixFloat
import iShape
这是一个如何使用 iShape 创建一个带有孔的正方形的示例
// Square with a hole
let shape = FixShape(
contour: [
FixVec(-FixFloat.unit * 4, -FixFloat.unit * 4),
FixVec(-FixFloat.unit * 4, FixFloat.unit * 4),
FixVec( FixFloat.unit * 4, FixFloat.unit * 4),
FixVec( FixFloat.unit * 4, -FixFloat.unit * 4)
], holes: [
FixVec(-FixFloat.unit * 2, -FixFloat.unit * 2),
FixVec(-FixFloat.unit * 2, FixFloat.unit * 2),
FixVec( FixFloat.unit * 2, FixFloat.unit * 2),
FixVec( FixFloat.unit * 2, -FixFloat.unit * 2)
]
)
欢迎您通过提交问题、提供反馈或提出 pull requests 来为 iShape 做出贡献。
本项目根据 MIT 许可证获得许可。 有关更多详细信息,请参见 LICENSE 文件。