JavaScript class to generate maps of triangles