modify distance.cpp, intersect.cpp