Adding a convenient sqr distance function