I might be missing the point on this (as I sometimes do), but isn't the shortest distance from point A to point B a straight line? So we could first calculate the equation of the straight line from A to B. To choose the next point in the path, we would first calculate the perpendicular distance to this straight line of each point under consideration. We would then choose the point that had the shortest perpendicular distance. Mark