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

@math.gl/polygon

Package Overview
Dependencies
Maintainers
4
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@math.gl/polygon

Polygon/polyline processing utilities

  • 3.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
197K
increased by3.87%
Maintainers
4
Weekly downloads
 
Created

What is @math.gl/polygon?

@math.gl/polygon is a JavaScript library for performing geometric operations on polygons. It is part of the math.gl suite, which provides high-precision mathematical operations for geospatial applications. This package is particularly useful for tasks such as polygon clipping, triangulation, and point-in-polygon tests.

What are @math.gl/polygon's main functionalities?

Polygon Clipping

This feature allows you to clip one polygon with another, effectively finding the intersection area between the two polygons.

const {clipPolygon} = require('@math.gl/polygon');
const subjectPolygon = [[0, 0], [10, 0], [10, 10], [0, 10]];
const clipPolygon = [[5, 5], [15, 5], [15, 15], [5, 15]];
const result = clipPolygon(subjectPolygon, clipPolygon);
console.log(result);

Triangulation

This feature breaks down a polygon into a set of triangles, which can be useful for rendering or computational geometry tasks.

const {triangulate} = require('@math.gl/polygon');
const polygon = [[0, 0], [10, 0], [10, 10], [0, 10]];
const triangles = triangulate(polygon);
console.log(triangles);

Point-in-Polygon Test

This feature checks whether a given point lies inside a polygon, which is useful for hit-testing and spatial queries.

const {isPointInPolygon} = require('@math.gl/polygon');
const polygon = [[0, 0], [10, 0], [10, 10], [0, 10]];
const point = [5, 5];
const isInside = isPointInPolygon(point, polygon);
console.log(isInside);

Other packages similar to @math.gl/polygon

Keywords

FAQs

Package last updated on 07 Jul 2020

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