This function return an array of the different absolute paths received as a string, converted to absolute points.
function pathToPoints( path ) {
var paths = path.split( /z|Z/ ), points = new Array();
for ( var i = 0; i < paths.length-1; i++ ) {
path = paths[i].split( /l|L/ );
path[0] = path[0].replace( /m|M/, '' );
for ( var j in path ) {
path[j] = path[j].split( ',' );
for ( var k in path[j] ) {
path[j][k] = parseFloat( path[j][k] );
if ( j != 0 ) {
path[j][k] += path[j-1][k];
}
}
}
for ( var j in path ) {
path[j] = path[j].join( ',' );
}
points[i] = path.join( ' ' );
}
return points;
}