Author Topic: Rotation of a 3x3 matrix  (Read 1917 times)

0 Members and 1 Guest are viewing this topic.

Offline Radical Pi

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1143
  • Rating: +5/-2
    • View Profile
    • RealityRevolution
Rotation of a 3x3 matrix
« on: December 24, 2007, 11:25:00 am »
So, I need to be able to do this for a certain *project* I'm working on. I didn't want to have to resort to a For() loop and manually store all coordinates into a temporary second matrix before overwriting the first one.
Is there any magical identity matrix that can do this? Or will I have to do it the boring way?

Just for clarification, I want:
c1-->
CODE
ec1[A B C]
[D E F]
[G H I]c2
ec2
to become:
c1
-->
CODE
ec1[G D A]
[H E B]
[I F C]
or
[C F I]
[B E H]
[A D G]c2
ec2

I'm doubting more and more that there's an efficient way of doing that, but if there is I can't seem to find it myself :Ptongue.gif
One of these days I'll get a sig I'm really proud of.

vuurrobin

  • Guest
Rotation of a 3x3 matrix
« Reply #1 on: December 24, 2007, 12:17:00 pm »
I think that rowswap([A],1,3)t would do the trick. the t is that superscript t for transpose

Offline Radical Pi

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1143
  • Rating: +5/-2
    • View Profile
    • RealityRevolution
Rotation of a 3x3 matrix
« Reply #2 on: December 24, 2007, 12:31:00 pm »
That works perfectly :Dbiggrin.gif
Thanks, I'll have to remember to mention you in the credits.
One of these days I'll get a sig I'm really proud of.

burr

  • Guest
Rotation of a 3x3 matrix
« Reply #3 on: December 24, 2007, 09:06:00 pm »
If you need some help remembering the matrix commands, we have a page for that on TI|BD: http://tibasicdev.wikidot.com/matrices.