Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EarCut

Build Status Build status Coverage Status codecov.io

Wrapper for earcut.hpp, a header only library for triangulating polygons.

License of wrapper: MIT

License of earcut.hpp: ISC

Install with:

Pkg.add("EarCut")
Pkg.test("EarCut")

Usage:

using EarCut, GeometryBasics
a = Circle(Point2f0(0), 0.5f0)
b = Circle(Point2f0(0), 1f0)
polygon = [decompose(Point2f0, b), decompose(Point2f0, a)] # some points defining a polygon. Must be a Vector{Vector{Point}}
triangle_faces = triangulate(polygon)

# then display with e.g. Makie like this:
using Makie, Colors

v = vcat(polygon...)
msh = GeometryBasics.Mesh(v, triangle_faces)

scene = Makie.mesh(v, triangle_faces; color = 1:length(v), shading = false, scale_plot = false, show_axis = false)

resulting in:

image

About

Wrapper for Mapbox's earcut.hpp for polygon triangulation

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages