![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Programming Guru
![]() ![]() |
Yeah, Andro, that is quite silly. Matrix math should only be used if you're doing transformations of non 90 degree intervals, or reverse transformations. Since the former is impossible to have in a nested list, it's best to stick with inverse functions/linear transformations.
|
|
|
|
|
|
#12 |
|
Professional Programmer
|
I may not have understood correctly, but..
Rotating about the X axis: [1, 0, 0] [0, cos x, -sin x] [0, sin x, cos x] Rotating about the Y axis: [cos x, 0, sin x] [0, 1, 0] [-sin x, 0, cos x] Rotating about Z: [cos x, -sin x, 0] [sin x, cos x, 0] [0, 0, 1] Although that may or may not do what you want, I haven't touched that stuff in a while now ![]() EDIT: You know I think this applies to transforming actual objects in a 3D coordinate space... not physically rotating a 3x3 matrix in place like you are describing... never mind all of this. |
|
|
|
|
|
#13 |
|
Programming Guru
![]() ![]() |
Your edit said it all.
![]() |
|
|
|
|
|
#14 | |
|
Programmer
Join Date: Apr 2005
Posts: 73
Rep Power: 4
![]() |
Quote:
If you _are_ using 3*3, you feel numpy is overkill, you need to do this frequently, you need the speed, and you don't want to use one of the reallocating solutions you could just roll your own: # Modifies a 3*3 list of lists inplace. No, it's not incredibly pretty.
def rot90(grid):
r1 = grid[0]
r2 = grid[1]
r3 = grid[2]
(r1[0], r1[1], r1[2],
r2[0], r2[2],
r3[0], r3[1], r3[2]) =\
(r3[0], r2[0], r1[0],
r3[1], r1[1],
r3[2], r2[2], r1[2]) |
|
|
|
|
|
|
#15 | |
|
Professional Programmer
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4
![]() |
Quote:
-- I reckon I better duck ... incoming -- ![]()
__________________
-Steven "Is this a piece of your brain?" - Basil Fawlty Last edited by stevengs; Jul 27th, 2006 at 6:00 PM. |
|
|
|
|
|
|
#16 |
|
Programming Guru
![]() ![]() |
I had assumed in DaWei's case it wasn't a question of inability, but a question of curiousity for the sake of seeing the alternatives. That, or he just wanted another tick on his little side counter there.
![]() |
|
|
|
|
|
#17 |
|
Professional Programmer
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4
![]() |
Naaa, it's probably a homework assignment, and we all know the rules about homework assignments..
![]()
__________________
-Steven "Is this a piece of your brain?" - Basil Fawlty |
|
|
|
|
|
#18 |
|
Programming Guru
![]() ![]() |
Hahahahaha. That's excellent. It must definitely be homework.
![]() |
|
|
|
|
|
#19 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Yeah, it's homework. I got an F. Except from Grumpy, who gave me an upside down F, and Narue, who gave me two Fs. I got pissed and moved to Germany, next town over from Steven, Bad Thang.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#20 | ||
|
Professional Programmer
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4
![]() |
Quote:
Quote:
__________________
-Steven "Is this a piece of your brain?" - Basil Fawlty |
||
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Python] Grid encryptor | Jessehk | Show Off Your Open Source Projects | 7 | Nov 29th, 2007 8:11 PM |
| Distance between 2 grid references | Oddball | Show Off Your Open Source Projects | 7 | Mar 12th, 2006 3:52 PM |
| easiest way to represent a grid? | keweedsmo | C++ | 4 | Feb 10th, 2006 7:03 PM |
| Little off-topic... Grid coordinate handling | CodeCaster | C++ | 13 | Jul 4th, 2005 8:07 AM |
| Need assistance with program | DJ_Mittens | C++ | 4 | Apr 20th, 2005 8:48 AM |