Polygon lookup using kd trees