I think the only required change is to change this line only:

    for ( var i = 0, il = positions.length / 3; i < il; i += 3 );

Alternatively, you can retain your change to this line. In that case, `a`, `b`, and `c` below can be removed and replaced with `i`, `i + 1`, ... , `i + 8`.