🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

polylabel

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polylabel

A JS library for finding optimal label position inside a polygon

1.0.2
Source
npm
Version published
Weekly downloads
232K
-3.58%
Maintainers
1
Weekly downloads
 
Created

What is polylabel?

The polylabel npm package is used to find the pole of inaccessibility of a polygon, which is the most distant internal point from the polygon's edges. This is useful for placing labels on polygons in a way that maximizes readability and avoids overlap with the edges.

What are polylabel's main functionalities?

Finding the pole of inaccessibility

This feature allows you to find the pole of inaccessibility for a given polygon. The code sample demonstrates how to use the polylabel function to find the optimal label position within a square polygon.

const polylabel = require('polylabel');
const polygon = [[[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]]];
const precision = 1.0;
const labelPosition = polylabel(polygon, precision);
console.log(labelPosition); // Outputs: [5, 5]

Other packages similar to polylabel

FAQs

Package last updated on 13 Oct 2016

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