Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
About
Team
Rules
Stats
Status
Sitemap
Chat
Downloads
Forum
News
Our Projects
Major Community Projects
Recent Posts
Unread Posts
Replies
Tools
SourceCoder3
Other Things...
Omnimaga Radio
TI-83 Plus ASM File Unsquisher
Z80 Conversion Tools
IES TI File Editor
Free RAM areas
Comprehensive Getkeyr table
URL Shortener
Online Axe Tilemap Editor
Help
Contact Us
Change Request
Report Issue/Bug
Team
Articles
Members
View the memberlist
Search For Members
Buddies
Login
Register
Omnimaga
»
Forum
»
Calculator Community
»
TI Calculators
»
TI-BASIC
»
[83+ BASIC] Rotating matix data...
« previous
next »
Print
Pages: [
1
]
2
Go Down
Author
Topic: [83+ BASIC] Rotating matix data... (Read 5681 times)
0 Members and 1 Guest are viewing this topic.
Demon
Guest
[83+ BASIC] Rotating matix data...
«
on:
July 15, 2006, 01:02:00 pm »
What would be a quick way to rotate a Matrix 90 degrees in either direction? And if you ran the same code again it would keep rotating it in a circle?
Second question: how would you make something move radially around a point (IE, the center of the screen) on the homescreen (not the graphscreen), so say in a "defend-the-castle" style game where you could have to shoot all the enemies coming your way, how would you rotate a character around whatever's in the center of the screen?
Logged
kalan_vod
LV11
Super Veteran (Next: 3000)
Posts: 2715
Rating: +10/-0
[83+ BASIC] Rotating matix data...
«
Reply #1 on:
July 15, 2006, 06:11:00 pm »
I think it would only work effeciently by going through the entire matix and rotating it. It wouldn't be too hard to make a rotating point, if you would like I could show some code for one.
Logged
Demon
Guest
[83+ BASIC] Rotating matix data...
«
Reply #2 on:
July 15, 2006, 06:20:00 pm »
QuoteBegin-kalan_vod+Jul 16 2006, 12:11 AM-->
QUOTE
(kalan_vod @ Jul 16 2006, 12:11 AM)
...if you would like I could show some code for one.
Sure.
Logged
Liazon
Guest
[83+ BASIC] Rotating matix data...
«
Reply #3 on:
July 16, 2006, 03:06:00 am »
man, I wish I remembered this from math class. To rotate a matrix, you need to multiply it by the right kind of matrix of the same size. This probably only works for square matrices though.
I think there's a formula for determining what to do. I'll get back to you on that, but first, are the matrices square?
edit: oops, I was confusing this with 3D math. Never mind.
Logged
Speler
LV8
Addict (Next: 1000)
Posts: 857
Rating: +6/-2
[83+ BASIC] Rotating matix data...
«
Reply #4 on:
July 16, 2006, 04:00:00 pm »
QUOTE
Second question: how would you make something move radially around a point (IE, the center of the screen) on the homescreen (not the graphscreen), so say in a "defend-the-castle" style game where you could have to shoot all the enemies coming your way, how would you rotate a character around whatever's in the center of the screen?
You would use sin( and cos( functions to do this inside something similar to a for( loop with the radius of the circle outside the two trig functions.
For example:
While 1
for(A,1,360
pt-On(10sin(A),10cos(A
pt-Off(10sin(A-1),10cos(A-1
End
End
Don't have enough experiance with matrices to answer the first question though sorry.
Logged
kalan_vod
LV11
Super Veteran (Next: 3000)
Posts: 2715
Rating: +10/-0
[83+ BASIC] Rotating matix data...
«
Reply #5 on:
July 17, 2006, 04:37:00 pm »
Well, what super speler said is true and it works fine (but he wanted to use it on the home screen). If you wanted to use this on the graph screen I could make something better than what I am about to post...Well I made two versions of this, and the one I posted is using a list >.>, the other was slower and bloated...but didnt use lists
.
QUOTE
:ClrHome
:"OO
:Output(4,8,Ans
:Output(5,8,Ans
:10
,9,3,Ans,4,Ans,5,Ans,6,Ans,6,9,6,8,6,7,5,7,4,7,3,7,3,8→L
1
→A:Ans→C:9→B:Ans→D:1→E
:Repeat θ=45
:Output(C,D,"
:L
1
(2E-1→A:L
1
(2E→B
:Output(A,Ans,".
:Ans→D:A→C
:Repeat Ans
:getKey→θ
:End
:E+(Ans=26)-(Ans=24
:Ans+12(‾(Ans=13)+not(Ans→E
:End
Logged
Demon
Guest
[83+ BASIC] Rotating matix data...
«
Reply #6 on:
July 17, 2006, 05:04:00 pm »
That one works pretty good. But I think I like the one that uses the sin and cos functions better because it would be easier to tell if you're making a turn and collide with something without having to use matrices.
Logged
kalan_vod
LV11
Super Veteran (Next: 3000)
Posts: 2715
Rating: +10/-0
[83+ BASIC] Rotating matix data...
«
Reply #7 on:
July 17, 2006, 05:41:00 pm »
Yes, but you asked for something using the homescreen. If you could incorparate those functions into using the homescree, if would work best.
Logged
Demon
Guest
[83+ BASIC] Rotating matix data...
«
Reply #8 on:
July 18, 2006, 06:04:00 am »
Hmm... I suddenly got an idea and now I like yours better...
Besides, I need to an ASCII game. Every since I learned the wonders of xLIB, I haven't done anything in pure ASCII since... time to revisit...
Logged
kalan_vod
LV11
Super Veteran (Next: 3000)
Posts: 2715
Rating: +10/-0
[83+ BASIC] Rotating matix data...
«
Reply #9 on:
July 19, 2006, 11:35:00 am »
So, the flipping sprite routine you added in your sprite program is going through the matrix?
Logged
Demon
Guest
[83+ BASIC] Rotating matix data...
«
Reply #10 on:
July 20, 2006, 04:33:00 pm »
Yeah, in the pixel editor, it does rowSwap to flip vertically, so that's no prob, but there's no colSwap command, so I had to make it go through half the matrix to flip horizontal.
Logged
dinhotheone
LV6
Super Member (Next: 500)
Posts: 410
Rating: +2/-1
[83+ BASIC] Rotating matix data...
«
Reply #11 on:
December 09, 2006, 11:36:00 am »
i'm not sure if you still care after these 4 months but i recently wrote a sprite rotator for a sprite editor pakage (basic) i was making. it flipps the sprite 90 degrees. but i think it would work for you. the main thing is that you take the matrix and decalre another matrix with flipped dimension so 3x2 is 2x3 then you do a nested for loop to hit all the originol dimesions and in the for loop you do
[matrix1](a,c)->[flippeddimensionmatrix]((original left,right dimension) + 1 - c,a))
in actuality the code i had was:
dim([A] -> LSize
{LSize(2),Lsize(1)} -> dim ([J]
for a, 1, Lsize(1)
for c, 1, Lsize(2)
[A](a,c) -> [J]((Lsize(2) + 1 - c), A)
end
end
[J] -> [A]
delvar [J]
Logged
Halifax
LV9
Veteran (Next: 1337)
Posts: 1334
Rating: +2/-1
[83+ BASIC] Rotating matix data...
«
Reply #12 on:
December 09, 2006, 11:47:00 am »
dinhotheone your a little wealth of knowledge aren't you
lol sweet routine
Logged
There are 10 types of people in this world-- those that can read binary, and those that can't.
DJ Omnimaga
Clacualters are teh gr33t
CoT Emeritus
LV15
Omnimagician (Next: --)
Posts: 55943
Rating: +3154/-232
CodeWalrus founder & retired Omnimaga founder
[83+ BASIC] Rotating matix data...
«
Reply #13 on:
December 09, 2006, 11:59:00 am »
that sound nice, that can be cool in addition to xLIB flip sprite routine, which flip sprite horizontally only though
Logged
Demon
Guest
[83+ BASIC] Rotating matix data...
«
Reply #14 on:
December 09, 2006, 06:37:00 pm »
Wow. And it's such a simple routine, too...
I'll try that, but instead of using a matrix, I'll make it use a Finance var so you can rotate really big selections without worrying about memory...
Logged
Print
Pages: [
1
]
2
Go Up
« previous
next »
Omnimaga
»
Forum
»
Calculator Community
»
TI Calculators
»
TI-BASIC
»
[83+ BASIC] Rotating matix data...