I haven't taken calculus so I might be thinking about this problem wrong, but it seems to me that if you are using straight lines (row and columns kind of need this) all you have to do is switch the x and y coordinates:
~ ~ ~ ~ ~ ~ 1 ~ ~ ~
1 2 3 4 5 ~ 2 ~ ~ ~
~ ~ ~ ~ ~ becomes ~ 3 ~ ~ ~
~ ~ ~ ~ ~ ~ 4 ~ ~ ~
~ ~ ~ ~ ~ ~ 5 ~ ~ ~
Then flip it vertically over the x,y axis
~ 1 ~ ~ ~ ~ 5 ~ ~ ~
~ 2 ~ ~ ~ ~ 4 ~ ~ ~
~ 3 ~ ~ ~ becomes ~ 3 ~ ~ ~
~ 4 ~ ~ ~ ~ 2 ~ ~ ~
~ 5 ~ ~ ~ ~ 1 ~ ~ ~
Did I do something incorrectly?
I think this would work for curved lines to.
------------------
Tell the truth and you will never fear someone will figure out you lied.
<<I'm sure I'm quoting someone out there, wish I knew who!>>
David Abresch