An open API service indexing awesome lists of open source software.

https://github.com/comradevanti/unityearclip

Super lightweight ear-clipping 2D polygon triangulation package for Unity
https://github.com/comradevanti/unityearclip

2d ear-clipping geometry mesh package polygon triangulation unity unity2d unity3d

Last synced: 8 months ago
JSON representation

Super lightweight ear-clipping 2D polygon triangulation package for Unity

Awesome Lists containing this project

README

          

# Ear-clip

[![openupm](https://img.shields.io/npm/v/dev.comradevanti.ear-clip?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/dev.comradevanti.ear-clip/)

Super lightweight ear-clipping 2D polygon triangulation package for Unity.
Can only handle [simple](https://en.wikipedia.org/wiki/Simple_polygon) polygons.

[Changelog](./CHANGELOG.md)

**⚠️ Development is paused ⚠️**
No new features will be added or bugs fixed unless requested through an issue.
If you wish to fork this repository and continue the work, you are very welcome
to do so.

## Usage

```csharp
using Dev.ComradeVanti.EarClip;

var points = new Vector2[] { ... };

// Points need to be in clockwise order
// Sort if needed
points = points.Clockwise().ToArray();

// Triangulate
var triangles = Triangulate.ConcaveNoHoles(points).ToArray();
```
## Installation

Install via OpenUPM `openupm add dev.comradevanti.ear-clip`

## Compatibility

Developed with for Unity 2021.3.