elliptical distance function added