
Transform a Mesh (Grid)
Hi guys, I'm looking some help with finding an equation to represent the transform I require for a program I'm making. Unfortunately I'm not Mathematician, infact this may even be in the wrong section, my math knowlefge is that bad.
Essentially I have a Mesh of, in my case, Pixels (computer graphics ones) and I want to transform certain pixels in this mesh in a fairly simple fashion.
The process is iterative and that's the part that is causing me problems with determining a nice equation to do this with. I will try to explain as best I can so maybe you can understand what I'm trying to do first.
My "mesh" is 20x20. I want to iteratively "fold" the top right corner in, diagonally across the page until the top right corner meets the bottom left corner.
The coordinate system I'm using has x=y=0 at the top left of the grid.
So, if the top right "pixel" is 20, I need to translate that x1, y+1, (left 1 pixel, down 1 pixel) essentially replacing the pixel at that position, then I need to take the top right 3 pixels (L shape), then 6 pixels, then 10 pixels, then 15 pixels, 21 ... (all traingles from the top right corner becoming increasingly larger until I reach half way.)
That's the first problem: Once that is sorted we can move on to part 2 (which is that the iterative process iterates through the pixels along the rows then down. (like a line feed and carriage return).
If my description wasn't very clear I can scan a drawing I have done of the process I'm looking to create.
Thanks.

It is not clear how an equation you are looking for actually represents the transformation. What exactly are you building the equation from? Is it the content of a pixel at (x, y) at time n based on pixels at time 0?
Also, it would help if you posted a series of pictures you described.

1 Attachment(s)
Ok
Picture is attached, if T represents a "pass" each progressivly increasing triangle is a new pass. The squares represent the top right corner of my set of pixels. The triangles essentially represent the "back of the page" because the pixels are "folded" over the original ones.
I have a construct that is presenting to me the x and y coordinates of each "pixel" iteratively from pixel 1 to pixel (20x20). As I am presented each, I am given the opportunity to perform a transform on each X andY coordinate of each pixel which are then stored into a new array which representes the orignal array transformed by some arbitrary transformation that I create.
My goal now is to have the top right corner of the pixels moved inwards in several passes representing the folding of the corner of a page.
Programatically, I am able to pass a "count" representing which "pass" i wish to occur, and then perform one of several calculations (i assume) which would differ for each pass making the folded part progressivly larger.

How about the following? I use the coordinate y' so that y' = 0 at the bottom. Thus, your coordinate y and y' are related by y + y' = 20. Therefore, to convert the following to your coordinates, just replace y' everywhere by 20  y.
Suppose n is the pass number. Then
If x + y' > 40  n, then (x, y') is blank.
Otherwise, if x + y' = 40  n, then (x, y') is the fold line.
Otherwise, if x >= 20  n and y' >= 20  n, then (x, y') has the color of the back of the page.
Otherwise, (x, y') has the original color.

thanks
Thanks, I'll have a look at that after the weekend and let you know how it goes.