I have a grid of rectangular cells covering a plane sitting at some distance from the coordinate system origin and would like to identify the grid cell where a straight line starting at the origin would intersect it.
The cells on the grid have equal sizes (dx,dy) and there are no gaps between cells, but since every cell on the plane has a different distance from the origin, the solid angle they cover is not constant -- if it was I could find a simple function that translates a direction (theta,phi) into a cell index (ix,iy).
Currently I use something like a nearest-neighbor search to find cells, but this doesn't exploit the "gridded-ness" of my cells at all. Is there any algorithm that would help me improve on this?
EDIT I know I could just use simple trigonometry to get the cell, but I am more interested in what algorithms there are that do nearest-neighbor searches on regularly spaced inputs.