add distance scalar function

should we document this implicit type casting here?