JSPM

point-in-triangle

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 134
  • Score
    100M100P100Q87054F
  • License MIT

test whether a point is inside a triangle

Package Exports

  • point-in-triangle

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (point-in-triangle) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

point-in-triangle

stable

Test whether a point is inside a triangle, using barycentric coordinates and this algorithm from BlackPawn.

var inside = require('point-in-triangle')

var triangle = [ [25, 10], [100, 250], [40, 40] ]
console.log(inside([25, 25], triangle))

You may also be interested in:

Usage

NPM

inside(point, triangle)

Returns true if the point [x, y] is inside the triangle [ [x1,y1], [x2,y2], [x3,y3] ], false otherwise.

License

MIT, see LICENSE.md for details.