coord_to_index-methods function

convert n-dimensional real world coordinates to 1D indices