» Goto page 1, 2, 3, 4  Next
Alright, so there are four types of transformations : Rotation, Reflection, Translation, and Dilation

The title it self says that I want to create a program that can transform objects.

Please watch this (I'm in need of something similar to this, it doesn't have to exactly the same with the fancy intro screen):

--------------------------------------------------------------------------------------

Let me give you some basic information

Translations slide given point(s), here are the rules ("B" is a point). So, for:

Up B —> (y+b)
Down B —> (y-b)
Left B —> (x-b)
Right B —> (x+b)

--------------------------------------------------------------------------------------

Reflection reflect given point(s) at a point, here are the rules (x and y are the points). So, for:

Reflection over X-axis : (x,y) —> (x,-y)
Reflection over Y-axis : (x,y) —> (-x,y)
Reflection over Y=x : (x,y) —> (y,x)
Reflection over Y=-x : (x,y) —> (-y,-x)

--------------------------------------------------------------------------------------

Rotations rotate point(s) at certain degrees, here are the rules (x and y are the points). So, for:

Rotation Clock-Wise 90 Degrees : (x,y) —> (y,-x)
Rotation 180 Degrees : (x,y) —> (-x,-y)
Rotation Counter Clock-Wise 90 Degrees : (x,y) —> (-y,x)

--------------------------------------------------------------------------------------

A dilation changes the size of the image (object).

The amount by which the image grows or shrinks is called the "Scale Factor".

If the scale factor is say 2, the image is enlarged so its dimensions are twice the original.

If it is 0.5, the image is reduced, with its dimensions half the original.

When the scale factor is 1, the image is the exact same size as the original.

P.S: In dilation, multiply the dimensions of the original by the scale factor to get the dimensions of the image.

--------------------------------------------------------------------------------------

That was a rough explanation of what I'm planning to create.

We all have busy lives and I know that what I mentioned above is not a easy job. Although, I'm a newbie to TI BASIC, I will try my best to cooperate with you guys.

I'm not saying you to create the whole program for me…You can just help me out with, for example, only "Translations". Just try to do your best.

That was all that I could possibly say.

Good Luck to you an me! Peace!

Translation works like this:

Translate Point (3,5) Left 6 and Up 2

So "left and right" is the change in x value and "up and down" is the change in y value.

If you want to translate point (3,5) left 6 and up 2, you do:

x=3-6=-3
y=5+2=7

If it was to translate point (3,5) right 6 and down 2, then it would be:

x=3+6=9
y=5-2=3

Notice that there is a change in sign when you go left or right, up or down...

Left = -
Right = +
Down = -
Up = +

Can a program be created to do this? It should prompt for x value and y value then display the answer and I dont want it to be graphed...

Hope that helps with translations...
Okay, I set it up for you, but I didn't make the entire program. And yes, I know I used labels, I'm such a terrible person... and I know this can still be optimized a bit.

Code:

:Lbl 1
:ClrHome
:0->dim(L1
:Input "PTS:",A   //how many points you have on your shape
:For(I,2,2A,2
:Input sub("ABCDEFGHIJK",I/2,1)+"X:",B   //the more alphabet you have, the more points you can have
:Input " Y:",C
:B->L1(1+dim(L1
:C->L1(1+dim(L1
:End
:Lbl 2

:Lbl A
:ClrHome
:Disp "MOVE BY?
:Prompt X,Y   //how much you will move along x/y axis. you can put a negative sign to move left/down
:For(I,1,dim(L1),2
:L1(I)+X->L1(I
:L1(I+1)+Y->L1(I+1
:End
:Pause L1
:Goto 2

Lbl B

reflection stuff

Pause L1
Goto 2

Lbl C

Rotation stuff

Pause L1
goto 2

Lbl D

dilation stuff

Pause L1
goto 2
Thank you so much

So in places of:

"reflection stuff "
"Rotation stuff"
"Rotation stuff "
"dilation stuff "

the code related to that subjects will go in, right?
AkonSpy wrote:
Thank you so much

So in places of:

"reflection stuff "
"Rotation stuff"
"Rotation stuff "
"dilation stuff "

the code related to that subjects will go in, right?

Yes, you would just follow the same pattern as the translation code. so you would do

Code:

//ask for what reflection/rotation/dilation user wants
For(I,1,dim(L1),2
whatever your transformation is -> new value of L1(I)
whatever your transformation is -> new value of L1(I+1)
End
Pause L1
Goto 2
Would you please mind setting it up for me...???
Of course, Pause L1 will display it as
{X Y X Y X Y (etc.)}

If you want to change the way it displays it you can use the Output( command, or you can use list compression so that it displays as
{X.Y X.Y X.Y (etc.)}
I found this, can this help us out:

Code:

ClrHome
Output(2,6,"MATRIX")
Output(3,7,"|v5.5")
Output(5,7,"BY")
Output(6,1,"KARL STOERZINGER")
Output(7,1,"RELEASED 12/2001")
Pause
1->Z
Z->Q
{2,1}->L6

{2,2}->dim([A])
{2,1}->dim([B])
[[0][0]]->[B]
Goto 0
Lbl ZZ
Menu("FINAL MATRIX:","DON'T SAVE",0,"SAVE -CURRENT",QC,"SAVE -SLOT 1",Q1,"SAVE -SLOT 2",Q2,"SAVE -SLOT 3",Q3,"SAVE -SLOT 4",Q4)
Lbl QC
[G]->[B]
Goto 0
Lbl Q1
[G]->[C]
Goto 0
Lbl Q2
[G]->[D]
Goto 0
Lbl Q3
[G]->[E]
Goto 0
Lbl Q4
[G]->[F]
Goto 0

Lbl 0
dim([B])->L6
L6(2)->Q
ClrHome

Lbl Z
StoreGDB 0
Lbl GO
AxesOff
Goto GG
Lbl G1
AxesOn
1->Xscl
1->Yscl
Goto GG
Lbl GC
ClrHome
Disp "ENTER Xscl/Yscl"
Input "SCALE=",Xscl
Xscl->Yscl
ClrHome
Lbl GG
{0}->L1
{0}->L2
dim([B])->L6
For(I,1,L6(2),1)
[B](1,I)->L1(I)
End
For(J,1,L6(2),1)
[B](2,J)->L2(J)
End
GridOff
FnOff
PlotsOff
Plot3(Scatter,L1,L2,plotsquare)
ZoomStat
ZSquare
Pause
RecallGDB 0
Goto 0

Lbl OZ
Lbl OS
ClrHome
Menu("SAVE MATRIX TO:","SLOT 1",S1,"SLOT 2",S2,"SLOT 3",S3,"SLOT 4",S4,"CANCEL",0)
Lbl S1
[B]->[C]
Goto 0
Lbl S2
[B]->[D]
Goto 0
Lbl S3
[B]->[E]
Goto 0
Lbl S4
[B]->[F]
Goto 0
Lbl OR
Menu("WHICH MATRIX?","SLOT 1",R1,"SLOT 2",R2,"SLOT 3",R3,"SLOT 4",R4,"CANCEL",0)
Lbl R1
[C]->[B]
Goto 0
Lbl R2
[D]->[B]
Goto 0
Lbl R3
[E]->[B]
Goto 0
Lbl R4
[F]->[B]
Goto 0

Lbl OC
ClrHome
Menu("VIEW MATRIX","CURRENT MATRIX",VC,"SLOT 1",V1,"SLOT 2",V2,"SLOT 3",V3,"SLOT 4",V4,"CANCEL",0)
Lbl VC
Pause [B]
Goto 0
Lbl V1
Pause [C]
Goto 0
Lbl V2
Pause [D]
Goto 0
Lbl V3
Pause [E]
Goto 0
Lbl V4
Pause [F]
Goto 0

Lbl OA
Input "DIM MATRX: (2*?) ",Z
If Z<1 or Z>20
Then
Disp "INVALID DIM","MUST BE 1 TO 20","PRESS ENTER"
Pause
Goto OA
End
Z->Q
{2,Z}->dim([B])
For(Y,1,Z,1)
For(X,1,2,1)
ClrHome
Disp "ELEMENT"
Output(1,9,{X,Y})
Input W
W->[B](X,Y)
End
End
Goto 0
Lbl OB
Lbl 66
Lbl 11
ClrHome
Input "ELEMENT {1,1}   ",A
ClrHome
Input "ELEMENT {2,1}   ",B
ClrHome
Input "ELEMENT {1,2}   ",C
ClrHome
Input "ELEMENT {2,2}   ",D
ClrHome
[[A,C][B,D]]->[H]
[H]->[A]
Goto 9
Lbl 22
[H]->[A]
Goto 9

Lbl 1
Lbl RE
ClrHome
Input "theta=",theta
[[cos(theta),~sin(theta)][sin(theta),cos(theta)]]->[A]
Goto 9
Lbl RA
[[1,0][0,1]]->[A]
Goto 9
Lbl RB
[[0,~1][1,0]]->[A]
Goto 9
Lbl RC
[[~1,0][0,~1]]->[A]
Goto 9
Lbl RD
[[0,1][~1,0]]->[A]
Goto 9
Lbl 9
ClrHome
Disp "TRANSFORMATION","MATRIX"
Pause [A]
ClrHome
Disp "FINAL MATRIX"
[A][B]->[G]
Pause [G]
Goto ZZ

Lbl 2
Lbl RX
[[1,0][0,~1]]->[A]
Goto 9
Lbl RY
[[~1,0][0,1]]->[A]
Goto 9
Lbl RZ
[[0,1][1,0]]->[A]
Goto 9
Lbl 3
ClrHome
Input "MAGNITUDE       ",M
[[M,0][0,M]]->[A]
Goto 9
Lbl 4
ClrHome
Input "X MAGNITUDE     ",X
Input "Y MAGNITUDE     ",Y
[[X,0][0,Y]]->[A]
Goto 9
Lbl 5
dim([B])->dim([A])
Input "X VALUE         ",X
Input "Y VALUE         ",Y
0->J
Disp Q
Lbl YY
J+1->J
X->[A](1,J)
Y->[A](2,J)
If J<Q
Goto YY
ClrHome
Disp "TRANSFORMATION","MATRIX"
Pause [A]
ClrHome
Disp "FINAL MATRIX"
[A]+[B]->[G]
Pause [A]+[B]
{2,2}->dim([A])
Goto ZZ
Lbl 7
ClrHome
I also found this, it's hard for me to understand:

Code:

DelVar {Y1}
DelVar {Y2}
DelVar A
DelVar B
DelVar C
DelVar D
DelVar Str1
Input "F(X)=",Str1
String>Equ(Str1,{Y1})
Disp "ALL ENTRIES"
Disp "SHOULD BE"
Disp "POSITIVE."
Pause
Goto 1
Lbl 1
ClrHome
Lbl 11
Input "HOW FAR?",C
If C<0
abs(C)->C
~C->C
ClrHome
Goto 2
Stop
Lbl 12
Input "HOW FAR?",C
If C<0
abs(C)->C
ClrHome
Goto 2
Stop
Lbl 13
0->C
ClrHome
Goto 2
Stop
Lbl 2
Lbl 21
Input "FACTOR?",B
If B<0
abs(B)->B
If B>1
Then
Disp "THIS IS A"
Disp "COMPRESSION!"
Input "PROCEED (Y/N)?",V
If V=Y
Then
ClrHome
Disp "COMPRESSION"
Goto 22
Else
Goto 21
End
End
ClrHome
Goto 3
Stop
Lbl 22
Input "FACTOR?",B
If B<0
abs(B)->B
If B>0 and B<1
Then
Disp "THIS IS A"
Disp "STRETCH!"
Disp "PROCEED (Y/N)?",V
If V=Y
Then
ClrHome
Disp "STRETCH"
Goto 21
Else
ClrHome
Disp "COMPRESSION"
Goto 22
End
End
ClrHome
Goto 3
Stop
Lbl 23
1->B
ClrHome
Goto 3
Stop
Lbl 3
Lbl 31
Input "FACTOR?",A
If A<0
abs(A)->A
If A>0 and A<1
Then
Disp "THIS IS A"
Disp "COMPRESSION!"
Input "PROCEED (Y/N)?",V
If V=Y
Then
ClrHome
Disp "COMPRESSION"
Goto 32
Else
Goto 31
End
End
ClrHome
Goto 4
Stop
Lbl 32
Input "FACTOR?",A
If A<0
abs(A)->A
If A>1
Then
Disp "THIS IS A"
Disp "STRETCH!"
Input "PROCEED (Y/N)?",V
If V=Y
Then
ClrHome
Disp "STRETCH"
Goto 31
Else
Goto 32
End
End
ClrHome
Goto 4
Stop
Lbl 33
1->A
ClrHome
Goto 4
Stop
Lbl 4
Lbl 41
~A->A
Goto 5
Stop
Lbl 42
~B->B
Goto 5
Stop
Lbl 43
~A->A
~B->B
Goto 5
Stop
Lbl 44
Goto 5
Stop
Lbl 5
Lbl 51
ClrHome
Input "HOW FAR?",D
If D<0
abs(D)->D
Goto 6
Stop
Lbl 52
ClrHome
Input "HOW FAR?",D
If D<0
abs(D)->D
~D->D
Goto 6
Stop
Lbl 53
0->D
Goto 6
Stop
Lbl 6
ClrHome
Output(1,1,"FINAL FNC:")
Output(2,1,A)
Output(2,14,"*")
Output(3,1,"FNC(")
Output(3,5,B)
Output(3,15,"*")
Output(4,1,"X-")
Output(4,4,C)
Output(4,15,")")
Output(5,1,"+")
Output(5,2,D)
Pause
Goto 7
Stop
Lbl 7
Lbl 71
(~10-C)/abs(B)->Xmin
(10+C)/abs(B)->Xmax
1/abs(B)->Xscl
(~10)/abs(A)+D->Ymin
(10)/abs(A)+D->Ymax
1/abs(A)->Yscl
"A{Y1}(BX-C)+D"->{Y2}
FnOff
FnOn 1,2
DispGraph
Pause
ClrHome
Stop
Lbl 72
ClrHome
Return
Stop
This website might be more helpful:

http://mathbits.com/MathBits/TISection/Geometry/Transformations.htm
Yes, I guess those would work, but they are very unoptimized... Plus you shouldn't need code that long. If you want, I can try to finish my program and post it here, but it might be a while, since I'm busy
Can the x and y values be stored are follows:

x into L1
y into L2
Yes, that would make it easier to transform, however that will take up a little bit more memory but overall it would probably be better
Michael2_3B wrote:
Yes, that would make it easier to transform, however that will take up a little bit more memory but overall it would probably be better

Can you do that for me because i'm trying it from this morning and i'm still getting errors?
Alright, so after 1 hour I came up with this (only translation):

Code:

ClrHome
Output(1,9,"TRANSLATION
Disp ""
Disp ""
Input "X-COORDINATE: ",X
Input "Y-COORDINATE: ",Y
X->L1(1)
Y->L2(1)
Disp ""
Disp "MOVE BY?"
Disp ""
Input "CHANGE IN X: ",A
Input "CHANGE IN Y: ",B
A+L1->L3
B+L2->L4
Disp ""
Output(10,8,"NEW POINTS: "
Disp {L3(1),L4(1)}
"

So, I want it to ask me how points are there and compile them accordingly.

Can The points be displayed as"

"Point A:"
"Point B:"
"Point C:"

"Point A':"
"Point B':"
"Point C':"

for the 'how many points thing, try this:

Code:
Input "amt of pts?",D
For(A,1,D
ClrHome
Disp "Point"
Output(1,7,A
Input "X",L1(A
Input "Y",L2(A
End
ClrHome                              *Here's the movement section*
Output(1,1,"Move by?"
Prompt X,Y
X+L1->L1
Y+L2->L2
For(A,1,D                            *Here's how to display the new points*
ClrHome
Disp "Point"
Output(1,7,A
Disp {L1(A),L2(A)
End

Also, you may want to check out some of the tutorials on http://tibasicdev.wikidot.com/development. I've been programming since 5th grade, and I still learned quite a bit from the site.
JLovern wrote:
for the 'how many points thing, try this:

Code:
Input "amt of pts?",D
For(A,1,D
ClrHome
Disp "Point"
Output(1,7,A
Input "X",L1(A
Input "Y",L2(A
End
ClrHome                              *Here's the movement section*
Output(1,1,"Move by?"
Prompt X,Y
X+L1->L1
Y+L2->L2
For(A,1,D                            *Here's how to display the new points*
ClrHome
Disp "Point"
Output(1,7,A
Disp {L1(A),L2(A)
End

Also, you may want to check out some of the tutorials on http://tibasicdev.wikidot.com/development. I've been programming since 5th grade, and I still learned quite a bit from the site.

Thanks for posting that I will return to you after testing it...

Code:
Input "Amt of Pts? ",D
D->dim(L1
D->dim(L2
For(A,1,D
Disp "Point"
Output(1,7,A
Prompt X                   *I'm using prompt instead of Input for efficiency
X->L1(A
Prompt Y
Y->L2(A
End
JLovern wrote:

Code:
Input "Amt of Pts? ",D
D->dim(L1
D->dim(L2
For(A,1,D
Disp "Point"
Output(1,7,A
Prompt X                   *I'm using prompt instead of Input for efficiency
X->L1(A
Prompt Y
Y->L2(A
End

So the lines "Disp "Point"" and "Output(1,7,A" are causing problems...

"Point 1" displays at 1,7 but "Point 2" is not displayed as expected...

"Point 1" in the first line turns into "Point 2"....

How to make the "numbers" move with "Point"....

Thanks for any help....

Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
» Goto page 1, 2, 3, 4  Next
» All times are UTC - 5 Hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum