The source of this question is an unanswered question at stackoverflow but I believe is more mathematical than computational. My question arising from this is. You have a two dimensional array of numbers, each element of the array is represented by a square box. The boxes arranged into a rectangle with element (i,j) represented by the box in position (i,j). A 1-dimensional slice of the array is formed by drawing a line across the boxes, choosing boxes based on the position of the line crossing them and a vector formed on the basis of the chosen boxes. This pdf file shows an issue arising following one attempt to do this. Are there already recognised ways of doing this? Are there better ways of doing this than the way I have tried? Can the question be stated in a more succinct way? Any help please.