(a, b, c)
| 13 | return 1 |
| 14 | } |
| 15 | function orientation(a, b, c) { |
| 16 | // Check orientation of Line(a, b) and Line(b, c) |
| 17 | const alpha = (b.y - a.y) / (b.x - a.x) |
| 18 | const beta = (c.y - b.y) / (c.x - b.x) |
| 19 | |
| 20 | // Clockwise |
| 21 | if (alpha > beta) return 1 |
| 22 | // Anticlockwise |
| 23 | else if (beta > alpha) return -1 |
| 24 | // Colinear |
| 25 | return 0 |
| 26 | } |
| 27 | |
| 28 | function convexHull(points) { |
| 29 | const pointsLen = points.length |