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

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

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

        var line      = data[i];

        var p1        = line[0];
        var p2        = line[1];
        var n         = line.length;

        p1.rotated    = rotateRxRyRz({x : point.x(p1), y : point.y(p1), z : point.z(p1)}, angles);
        p2.rotated    = rotateRxRyRz({x : point.x(p2), y : point.y(p2), z : point.z(p2)}, angles);

        p1.projected  = project(p1.rotated, options);
        p2.projected  = project(p2.rotated, options);

        line.centroid = {x: (p1.x + p2.x)/n, y: (p1.y + p2.y)/n, z: (p1.z + p2.z)/n};
    }
    return data;
}<commit_msg>add centroid()<commit_after>import {centroid}       from '../centroid';
import {project}        from '../projection';
import {rotateRxRyRz}   from '../rotation';

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

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

        var line      = data[i];

        var p1        = line[0];
        var p2        = line[1];

        p1.rotated    = rotateRxRyRz({x : point.x(p1), y : point.y(p1), z : point.z(p1)}, angles);
        p2.rotated    = rotateRxRyRz({x : point.x(p2), y : point.y(p2), z : point.z(p2)}, angles);

        p1.projected  = project(p1.rotated, options);
        p2.projected  = project(p2.rotated, options);

        line.centroid = centroid(line);
    }
    return data;
}
{'fraction_non_alphanumeric': 0.17541613316261204, 'fraction_numerical': 0.026888604353393086, 'mean_word_length': 2.095049504950495, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6690382', 'n_tokens_mistral': 597, 'n_tokens_neox': 577, 'n_words': 134}