Send to a Friend

HeroicZach's avatar

Is there a mathematical method that takes a matrix and generates a "diamond" of values from rotating it 45 degrees?

Asked by HeroicZach (195points) November 29th, 2010

I’m writing a program that simulates a game, and to do so I need to come up with a function that can rotate a matrix by 45 degrees, essentially. So if I have a 5 by 5 matrix, I need to generate a list of lists looking like:
5,5
4,1 5,2
3,1 4,2 5,3
etc etc all the way down to 1,5

I’m wondering how an operation like this would work…thanks!

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.