Create mesh.c

Old version of the code.