Results 1 to 5 of 5

Math Help - Transform a Mesh (Grid)

  1. #1
    Newbie
    Joined
    Aug 2007
    Posts
    23

    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, in-fact 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 x-1, 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.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Joined
    Oct 2009
    Posts
    5,513
    Thanks
    769
    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.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Aug 2007
    Posts
    23

    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.
    Attached Thumbnails Attached Thumbnails Transform a Mesh (Grid)-imag0031.jpg  
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor
    Joined
    Oct 2009
    Posts
    5,513
    Thanks
    769
    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.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Aug 2007
    Posts
    23

    thanks

    Thanks, I'll have a look at that after the weekend and let you know how it goes.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Divergence and Laplacian of a FEM mesh?
    Posted in the Differential Equations Forum
    Replies: 2
    Last Post: April 10th 2011, 05:55 AM
  2. Replies: 17
    Last Post: August 22nd 2010, 11:40 PM
  3. Mesh and Nodal Analysis
    Posted in the Advanced Applied Math Forum
    Replies: 0
    Last Post: January 24th 2010, 08:18 AM
  4. Matlab mesh problem
    Posted in the Math Software Forum
    Replies: 3
    Last Post: March 21st 2009, 12:11 PM
  5. mesh
    Posted in the Calculus Forum
    Replies: 1
    Last Post: March 4th 2008, 01:55 PM

Search Tags


/mathhelpforum @mathhelpforum