point-in-triangle

1.0.1 • Public • Published

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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    1,414
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    1,414
  • 1.0.0
    1

Package Sidebar

Install

npm i point-in-triangle

Weekly Downloads

1,415

Version

1.0.1

License

MIT

Last publish

Collaborators

  • mattdesl