Add the methods in MathUtil to calculate the distance and find the
nearest point.