C++ Version of DistMesh