/*
 * Dessine des paths reliant chaque point d'une couleur et referme la figure
 */
function draw(dots, couleurs) {
    var width = 6;
    var couleurs = ["#3C61A6", "#AD519A", "#BF2130", "#DE703C", "#F9C34A", "#8FB65A", "#3C61A6", "#AD519A", "#BF2130", "#DE703C", "#F9C34A", "#8FB65A", "#3C61A6", "#AD519A", "#BF2130", "#DE703C", "#F9C34A", "#8FB65A"];
    var d = "";

    var counter = 0;
    for (var i = 0; i < NB_POINTS - 1; i++) {
        //point lineto prochain point
        d = "M " + scale(dots[counter], width) + "," + scale(dots[counter + 1], width) + " l " + (scale(dots[counter + 2], width) - scale(dots[counter], width)) + "," + (scale(dots[counter + 3], width) - scale(dots[counter + 1], width));
        createPath(i, d, width, couleurs[i]);
        counter += 2;
    }
    //la dernier ligne revient sur le dernier point
    d = "M " + scale(dots[2 * NB_POINTS - 2], width) + "," + scale(dots[2 * NB_POINTS - 1], width) + " l " + (scale(dots[0], width) - scale(dots[2 * NB_POINTS - 2], width)) + "," + (scale(dots[1], width) - scale(dots[2 * NB_POINTS - 1], width));
    createPath(NB_POINTS - 1, d, width, "black");
}