use kd-tree for the points indexing and increase performance