Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Larpon/earcut
Hand-ported (near 1:1) V version of https://github.com/mapbox/earcut
https://github.com/Larpon/earcut
Last synced: about 1 month ago
JSON representation
Hand-ported (near 1:1) V version of https://github.com/mapbox/earcut
- Host: GitHub
- URL: https://github.com/Larpon/earcut
- Owner: larpon
- License: mit
- Created: 2020-11-03T16:21:15.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-08-29T15:00:12.000Z (over 1 year ago)
- Last Synced: 2024-08-04T01:04:45.132Z (5 months ago)
- Language: V
- Size: 58.6 KB
- Stars: 14
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-v - V Earcut - fast (real-time) polygon triangulation library based on [mapbox/Earcut](https://github.com/mapbox/earcut) to handle holes, twisted polygons, degeneracies and self-intersections. (Libraries / Graphics)
README
# earcut
A hand-ported V version of [mapbox/earcut](https://github.com/mapbox/earcut).
The implementation is currently based on commit [f40dd2](https://github.com/mapbox/earcut/tree/f40dd273cb8c6911581a01f9c8de2b22a591dffb)
## Example
```v
module mainimport earcut
fn main() {
flat := earcut.flatten(v_logo)
vertices := flat.vertices
holes := flat.holes
indicies := earcut.earcut(vertices, holes, 2)
println(indicies)
println(earcut.deviation(vertices, holes, 2, indicies))
}const (
v_logo = [[
[f32(1), 1], [f32(3.5), 1.4],
[f32(5), 6],
[f32(6.5), 1.4], [f32(9), 1],
[f32(6), 9], [f32(4), 9],
]]
)
```