Finds the index of the nearest segment on the given cell state for the specified coordinate pair.