|
-
Feb 21st, 2004, 04:42 PM
#1
Thread Starter
Lively Member
Fast Way To Rotate In 2D
I have been researching this topic for a while and i have found out a fast way to rotate.
the usual way is to pass all the cor's to a simple
Xt=X*cos(angle)+Y*Sin(Angle)
Yt=Y*cos(angle)-X*sin(angle)
ofcourse its very slow, and even if you precalc the sin cos tables
a faster way is to rotate the edges and to complete it with Bresenham Line-Drawing Algorythm
And the easiest way i have found is :
lets say u want to rotate in 20 deg :
Xinc=Cos(20*pi/180) ,Yinc=sin(20*pi/180)
and for every line of the 2d pic u add the X and The Y
and when u finish the line , u add the x and y the SINCOS of the angle+90
to go forward
i got about 500 frames Non Compile version
even faster is not to draw the black points if your screen back is black
-
Feb 21st, 2004, 10:10 PM
#2
Since this isn't a question, it should probably be in the CodeBank. Would you like me to move it?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|