Skip to content

Instantly share code, notes, and snippets.

@wewindy
Created December 6, 2021 02:19
Show Gist options
  • Select an option

  • Save wewindy/e0aecc8a58dd52fd218adc78e2be5a4e to your computer and use it in GitHub Desktop.

Select an option

Save wewindy/e0aecc8a58dd52fd218adc78e2be5a4e to your computer and use it in GitHub Desktop.
is-clockwise
type Point = [number, number, number?]
const isCCW = (p1: Point, p2: Point, p3: Point) => {
return (p2[0] - p1[0]) * (p3[1] - p1[1]) - (p2[1] - p1[1]) * (p3[0] - p1[0]) > 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment