coor function

Transforms a x,y position in a cartesian plane into a position in a 1D array.