A Quasi-isometric Embedding Algorithm