add distance scalar function

use static map