https://github.com/schwa/earcut-swift
https://github.com/schwa/earcut-swift
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/schwa/earcut-swift
- Owner: schwa
- Created: 2023-10-31T18:09:50.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-16T21:02:55.000Z (over 1 year ago)
- Last Synced: 2025-03-07T18:12:11.445Z (2 months ago)
- Language: Swift
- Size: 996 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# earcut-swift
Attempt to build a Swift wrapper around MapBox's earcut cpp project for triangulating polygons.
## Project Structure
The project uses Swift Packages and Swift's new C++ interop to build a wrapper around the earcut C++ (header only) project.
### Swift Package Structure
* earcut: A Swift target that wraps and exposes a Swift only interface for earcut.
* earcut_cpp: A C++ target that consist of a header defining a SIMD/Swift Array based interface to earcut.
* earcut.hpp: A C++ header living inside the earcut_cpp target. This is a (git submodule) copy of the earcut.hpp header from the earcut project.The structure looks like this.
`// earcut -> earcut_cpp -> earcut_bridge`
```mermaid
graph TD;
earcut-->earcut_cpp;
earcut_cpp-->earcut.hpp;
```