<commit_before>import {centroid}       from '../centroid';
import {project}        from '../projection';
import {rotateRxRyRz}   from '../rotation';

export function lineStrip(data, options, point, angles){

    for (var i = data.length - 1; i >= 0; i--) {

        var l = data[i];

        for (var j = l.length - 1; j >= 0; j--) {
            var p = l[j];
            p.rotated   = rotateRxRyRz({x : point.x(p), y : point.y(p), z : point.z(p)}, angles);
            p.projected = project(p.rotated, options);
        }

        var mid = l.length/2;
        var int = parseInt(mid);
        l.centroid = mid === int ? centroid([ l[mid - 1], l[mid] ]) : {x: l[int].rotated.x, y: l[int].rotated.y, z: l[int].rotated.y};
    }


    return data;
}<commit_msg>fix issues with centroid calc<commit_after>import {centroid}       from '../centroid';
import {project}        from '../projection';
import {rotateRxRyRz}   from '../rotation';

export function lineStrip(data, options, point, angles){

    for (var i = data.length - 1; i >= 0; i--) {

        var l = data[i], m = l.length/2, t = parseInt(m);

        for (var j = l.length - 1; j >= 0; j--) {
            var p = l[j];
            p.rotated   = rotateRxRyRz({x : point.x(p), y : point.y(p), z : point.z(p)}, angles);
            p.projected = project(p.rotated, options);
        }

        l.centroid = t === m ? centroid([ l[m - 1], l[m] ]) : { x: l[t].rotated.x, y: l[t].rotated.y, z: l[t].rotated.z };
    }


    return data;
}
{'fraction_non_alphanumeric': 0.19143239625167335, 'fraction_numerical': 0.008032128514056224, 'mean_word_length': 2.0572597137014315, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '5808664', 'n_tokens_mistral': 562, 'n_tokens_neox': 544, 'n_words': 146}