function fixOrientation(points, hole) {
    var _a, _b;
    if (hole === void 0) { hole = false; }
    var m = points.length;
    if (m < 6) {
        return;
    }
    var area = 0;
    for (var i = 0, x1 = points[m - 2], y1 = points[m - 1]; i < m; i += 2) {
        var x2 = points[i];
        var y2 = points[i + 1];
        area += (x2 - x1) * (y2 + y1);
        x1 = x2;
        y1 = y2;
    }
    if ((!hole && area > 0) || (hole && area <= 0)) {
        var n = m / 2;
        for (var i = n + (n % 2); i < m; i += 2) {
            var i1 = m - i - 2;
            var i2 = m - i - 1;
            var i3 = i;
            var i4 = i + 1;
            _a = [points[i3], points[i1]], points[i1] = _a[0], points[i3] = _a[1];
            _b = [points[i4], points[i2]], points[i2] = _b[0], points[i4] = _b[1];
        }
    }
}
Destroy and don't use after this.