Update mindistance.cpp