Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

earcut

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

earcut

The fastest and smallest JavaScript polygon triangulation library for your WebGL apps

  • 1.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.4M
increased by4.43%
Maintainers
1
Weekly downloads
 
Created

What is earcut?

The earcut npm package is a JavaScript library for triangulating polygons for WebGL rendering. It is a fast, lightweight, and robust library for polygon triangulation, which is the process of converting polygons into triangles that can be used for rendering 3D graphics.

What are earcut's main functionalities?

Polygon Triangulation

This feature allows you to triangulate a polygon with or without holes. The 'vertices' array contains the x and y coordinates of the polygon's vertices, 'holes' is an array of indices that mark the start of each hole in the vertex array, and 'dimensions' is the number of coordinates per vertex (2 for 2D polygons). The 'earcut' function returns an array of indices that map to the triangulated vertices.

const earcut = require('earcut');
const vertices = [10, 0, 0, 50, 60, 60, 70, 10];
const holes = [4];
const dimensions = 2;
const triangles = earcut(vertices, holes, dimensions);

Other packages similar to earcut

FAQs

Package last updated on 27 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc