method for finding Euclidean distance between objects