generalised distance