(points, options = {})
| 101678 | return Math.sign(getPolygonSignedAreaPoints(points, options)); |
| 101679 | } |
| 101680 | function getPolygonSignedAreaPoints(points, options = {}) { |
| 101681 | const { start =0 , end =points.length } = options; |
| 101682 | let area = 0; |
| 101683 | for(let i = start, j = end - 1; i < end; ++i){ |
| 101684 | area += (points[i][0] - points[j][0]) * (points[i][1] + points[j][1]); |
| 101685 | j = i; |
| 101686 | } |
| 101687 | return area / 2; |
| 101688 | } |
| 101689 | function forEachSegmentInPolygonPoints(points, visitor, options = {}) { |
| 101690 | const { start =0 , end =points.length , isClosed } = options; |
| 101691 | for(let i = start; i < end - 1; ++i)visitor(points[i], points[i + 1], i, i + 1); |
no outgoing calls
no test coverage detected