javascript - Triangulation Three.js algorithm -


i trying make triangulation algorithm, following simple rules, in javascript using three.js.

here actual steps:

enter image description here

we start square , "randomly" define heights cells, after symmetric division in 4 parts.

i intend make "steps" dat.gui panel.

i appreciate if can me!