JSPM

is-clockwise

2.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 27
  • Score
    100M100P100Q98835F
  • License MIT

test if 2D convex polygon is clockwise

Package Exports

  • is-clockwise

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 (is-clockwise) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

is-clockwise

stable

Returns true if the sum of signed distances is greater than zero, which can be used as a quick test for convex polygon orientation.

var isClockwise = require('is-clockwise')
var points = [ [0, 0], [1, 1], [1, 0], [0, 0] ]

var cw = isClockwise(points)

console.log(cw) // true

See robust-orientation for a stronger test that handles floating point errors and other edge cases.

Usage

NPM

isClockwise(points)

Returns true if the points are clockwise, false if counter-clockwise. Assuming cartesian space.

License

MIT, see LICENSE.md for details.