Fixed distance functor. Added test of LineDistanc:e.

Signed-off-by: Nikolay Lyalyushkin <nikolay.lyalyushkin@intel.com>