Skip to content

mattdesl/is-clockwise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

test if polygon is clockwise

Resources

License

Stars

Watchers

Forks

Packages

No packages published