added 2D and 3D distance formulas