pixi.js
Version:
<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">
25 lines (22 loc) • 503 B
JavaScript
;
;
function getOrientationOfPoints(points) {
const m = points.length;
if (m < 6) {
return 1;
}
let area = 0;
for (let i = 0, x1 = points[m - 2], y1 = points[m - 1]; i < m; i += 2) {
const x2 = points[i];
const y2 = points[i + 1];
area += (x2 - x1) * (y2 + y1);
x1 = x2;
y1 = y2;
}
if (area < 0) {
return -1;
}
return 1;
}
exports.getOrientationOfPoints = getOrientationOfPoints;
//# sourceMappingURL=getOrientationOfPoints.js.map