src/index.js
function polygonCopy(polygon, i,j,targetPoly){
    var p = targetPoly || [];
    polygonClear(p);
    if (i < j) {
        // Insert all vertices from i to j
        for(var k=i; k<=j; k++){
            p.push(polygon[k]);
        }

    } else {

        // Insert vertices 0 to j
        for(var k=0; k<=j; k++){
            p.push(polygon[k]);
        }

        // Insert vertices i to end
        for(var k=i; k<polygon.length; k++){
            p.push(polygon[k]);
        }
    }

    return p;
}
function polygonCopy(polygon, i,j,targetPoly){
    var p = targetPoly || [];
    polygonClear(p);
    if (i < j) {
        // Insert all vertices from i to j
        for(var k=i; k<=j; k++){
            p.push(polygon[k]);
        }

    } else {

        // Insert vertices 0 to j
        for(var k=0; k<=j; k++){
            p.push(polygon[k]);
        }

        // Insert vertices i to end
        for(var k=i; k<polygon.length; k++){
            p.push(polygon[k]);
        }
    }

    return p;
}
function polygonCopy ( polygon , i , j , targetPoly ) { var p = targetPoly || [ ] ; polygonClear ( p ) ; if ( i < j ) { // Insert all vertices from i to j for ( var k = i ; k <= j ; k ++ ) { p . push ( polygon [ k ] ) ; } } else { // Insert vertices 0 to j for ( var k = 0 ; k <= j ; k ++ ) { p . push ( polygon [ k ] ) ; } // Insert vertices i to end for ( var k = i ; k < polygon . length ; k ++ ) { p . push ( polygon [ k ] ) ; } } return p ; }
Copy the polygon from vertex i to vertex j.
@method copy
@param  {Number} i
@param  {Number} j
@param  {Polygon} [targetPoly]   Optional target polygon to save in.
@return {Polygon}                The resulting copy.
Copy the polygon from vertex i to vertex j .