Change double dist to double dist[] in nearest function.
It improves performance since the smaller distances found on the left subtree are visible when the algorithm search the right subtree.

Added Illegal Argument exception to Point distance function.
The number of dimensions must be the same.