Is it possible that you optimize this snippet and add it to a new version of jPCT (and ae) ?
use it like
Terrain terrain = new Terrain();
terrain.Generate(sizex, sizex, maxheight);
and
terrain.fromHeightmap(resource image);
or/and
terrain.fromHeightmap("path/to/image");
returning Object3D
and perhaps a SimpleVector getSize() to return the size of the terrain in a SimpleVector.