SwiftEarcut

1.0.0

🤖 A Swift port of Mapbox's earcut.js library
measuredweighed/SwiftEarcut

What's New

1.0.0

2024-07-01T17:50:37Z

Initial release

SwiftEarcut

A Swift port of Mapbox's earcut.js polygon triangulation library.

Table of Contents

  1. License
  2. Installation
  3. Documentation
  4. Quick Start

License

Mapbox's earcut.js is governed by an ISC license while this Swift port is governed by an MIT license.

Installation

Swift Package Manager

Add the following dependency

.package(url: "https://github.com/measuredweighed/SwiftEarcut.git", from: "2.2.4"),

Documentation

Comprehensive documentation for SwiftEarcut can be found on the Swift Package Index (click on Documentation).

Quick Start

Pass Earcut a flat array of vertex coordinates and optionally include an array of hole indices, and the tesselate function will return a flat array of triangle indices.

let result = Earcut.tesselate(data: [10, 0, 0, 50, 60, 60, 70, 10])

// result: [1, 0, 3, 3, 2, 1]

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri May 16 2025 14:09:04 GMT-0900 (Hawaii-Aleutian Daylight Time)