Computes the distance between two positions. (Leaving the second input empty will output the magnitude of the vector instead of distance between two positions.)