Split distance.c into cartesian.*