Skip to content

rclancey/go-earcut

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

earcut

A library for efficiently transforming polygons into triangles in go.

Build Status Go Report Card Documentation Coverage Status GitHub issues license Release

About

This is a direct port of Mapbox's JavaScript earcut library.

Usage

// flat array of all vertices in polygon, including holes
verts := []float64{
    0.0, 0.0,
    1.0, 0.0,
    1.0, 1.0,
    0.0, 1.0,
    0.0, 0.0,
    0.25, 0.25,
    0.75, 0.25,
    0.75, 0.75,
    0.25, 0.75,
    0.25, 0.25,
}
holes := []int{5} // *vertex* index of beginning of each hole
dims := 2 // number of values per vertex
indices, err := earcut.Earcut(verts, holes, dims)
// indices is an array of integers (3 per triangle) referencing
// the polygon vertexes that make up each triangle

Documentation

See Mapbox and GoDoc.org for complete documentation.

Author

Original implementation by Mapbox. Go port by Ryan Clancey

License

earcut is licensed under the ISC license, described in the LICENSE file.

About

golang port of Mapbox earcut library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages