2D Ppath constructor in JavaScript.