src/Tools/babylon.earcut.js
/**
     *  turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts
     */
turn a polygon in a multi-dimensional array form  into a form Earcut accepts
turn a polygon in a multi - dimensional array form into a form Earcut accepts
function flatten(data) {
        var dim = data[0][0].length, result = { vertices: [], holes: [], dimensions: dim }, holeIndex = 0;
        for (var i = 0; i < data.length; i++) {
            for (var j = 0; j < data[i].length; j++) {
                for (var d = 0; d < dim; d++)
                    result.vertices.push(data[i][j][d]);
            }
            if (i > 0) {
                holeIndex += data[i - 1].length;
                result.holes.push(holeIndex);
            }
        }
        return result;
    }
function flatten ( data ) { var dim = data [ 0 ] [ 0 ] . length , result = { vertices : [ ] , holes : [ ] , dimensions : dim } , holeIndex = 0 ; for ( var i = 0 ; i < data . length ; i ++ ) { for ( var j = 0 ; j < data [ i ] . length ; j ++ ) { for ( var d = 0 ; d < dim ; d ++ ) result . vertices . push ( data [ i ] [ j ] [ d ] ) ; } if ( i > 0 ) { holeIndex += data [ i - 1 ] . length ; result . holes . push ( holeIndex ) ; } } return result ; }
turn a polygon in a multi-dimensional array form (e.g.
turn a polygon in a multi - dimensional array form ( e . g .