Euclid is a Swift library for creating and manipulating 3D geometry using techniques such as extruding or "lathing" 2D paths to create solid 3D shapes, and CSG (Constructive Solid Geometry) to combine or subtract those shapes from one another.
Euclid is the underlying implementation for the open source ShapeScript scripting language and ShapeScript Mac and iOS apps. Anything you can build in ShapeScript can be replicated programmatically in Swift using this library.
If you would like to support the development of Euclid, please consider buying a copy of ShapeScript (the app itself is free, but there is an in-app purchase to unlock some features). You can also donate directly to the project via PayPal:
Euclid is packaged as a dynamic framework that you can import into your Xcode project. You can install this manually, or by using CocoaPods, Carthage, or Swift Package Manager.
Note: Euclid requires Xcode 14+ to build, and runs on iOS 11+ or macOS 10.13+.
To install Euclid using CocoaPods, add the following to your Podfile:
pod 'Euclid', '~> 0.6'
To install using Carthage, add this to your Cartfile:
github "nicklockwood/Euclid" ~> 0.6
To install using Swift Package Manager, add this to the
dependencies: section in your Package.swift file:
.package(url: "https://github.com/nicklockwood/Euclid.git", .upToNextMinor(from: "0.6.0")),
Feel free to open an issue in Github if you have questions about how to use the library, or think you may have found a bug.
If you wish to contribute improvements to the documentation or the code itself, that's great! But please read the CONTRIBUTING.md file before submitting a pull request.
See the included project for an example of how Euclid can be used in conjunction with SceneKit or RealityKit to generate and render a nontrivial 3D shape on iOS.
Full documentation for all Euclid types and functions can be found here.
The Euclid framework is primarily the work of Nick Lockwood.