<commit_before>var Vector3 = function(x, y, z) {
    if (typeof(x) === "number") {
        this.x = x;
        this.y = y;
        this.z = z || 0.0;
    }
    else {
        this.x = x.x || x[0];
        this.y = x.y || x[1];
        this.z = x.z || x[2] || 0.0;
    }

    this.toPoint = function() {
        return L.point(this.x, this.y);
    };
};

var Vector4 = function(x, y, z, w) {
    if (typeof(x) === "number") {
        this.x = x;
        this.y = y;
        this.z = z || 0.0;
        this.w = w || 1.0;
    }
    else {
        this.x = x.x || x[0];
        this.y = x.y || x[1];
        this.z = x.z || x[2] || 0.0;
        this.w = x.w || x[3] || 1.0;
    }
};

var space = {
    Vector3: Vector3,
    Vector4: Vector4
};

module.exports = space;<commit_msg>Fix for MPLY-8837 Partial revert of https://github.com/wrld3d/wrld.js/commit/1cfb3cd1f18c4d0f669b6ae1badcc30dfad22a23 Restore API points used by webgl example app and map designer. Buddy: Malc<commit_after>var Vector3 = function(x, y, z) {
    if (typeof(x) === "number") {
        this.x = x;
        this.y = y;
        this.z = z || 0.0;
    }
    else {
        this.x = x.x || x[0];
        this.y = x.y || x[1];
        this.z = x.z || x[2] || 0.0;
    }

    this.toPoint = function() {
        return L.point(this.x, this.y);
    };
};

var Vector4 = function(x, y, z, w) {
    if (typeof(x) === "number") {
        this.x = x;
        this.y = y;
        this.z = z || 0.0;
        this.w = w || 1.0;
    }
    else {
        this.x = x.x || x[0];
        this.y = x.y || x[1];
        this.z = x.z || x[2] || 0.0;
        this.w = x.w || x[3] || 1.0;
    }
};

// TODO: fix DRY fail -- this should move to platform
// Judging by Leaflet, approx = 2.74287e7 * Math.exp(-0.622331 * zoom)
var _altitudes = [
    27428700,
    14720762,
    8000000,
    4512909,
    2087317,
    1248854,
    660556,
    351205,
    185652,
    83092,
    41899,
    21377,
    11294,
    5818,
    3106,
    1890,
    1300,
    821,
    500,
    300,
    108,
    58,
    31,
    17,
    9,
    5
];

var _altitudeToZoom = function(altitude, comparisonFunc) {
    var zoom = _altitudes.findIndex(function(zoomLevelDistance) {
        return comparisonFunc(altitude, zoomLevelDistance);
    });
    var maxZoom = _altitudes.length - 1;
    return (zoom === -1) ? maxZoom : zoom;
};


var zoomToDistance = function(zoom) {
    if(zoom < 0) {
        return _altitudes[0];
    }
    else if (zoom >= _altitudes.length) {
        return _altitudes[_altitudes.length - 1];
    }
    return _altitudes[zoom];
};

var distanceToZoom = function(distance) {
    return nearestZoomAbove(distance);
};

var nearestZoomAbove = function(distance) {
    var zoomAbove = _altitudeToZoom(distance, function(d, z) { return d > z; });
    return Math.max(0, zoomAbove - 1);
};

var nearestZoomBelow = function(distance) {
    return _altitudeToZoom(distance, function(d, z) { return d >= z; });
};


var space = {
    Vector3: Vector3,
    Vector4: Vector4,
    zoomToDistance: zoomToDistance,
    distanceToZoom: distanceToZoom,
    nearestZoomAbove: nearestZoomAbove,
    nearestZoomBelow: nearestZoomBelow
};

module.exports = space;
{'fraction_non_alphanumeric': 0.1598116169544741, 'fraction_numerical': 0.06656200941915227, 'mean_word_length': 1.980355472404116, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1958747', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1226, 'n_words': 281}