Public Group

#### Archived

This topic is now archived and is closed to further replies.

# Rotating Using a "Slope-Comparison"

This topic is 5871 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I''ve read a little abotu how yu would go about roating things, using sin/cos, and though I am reasonably comfortable using them, I still did not quite understand why the rotation worked. Being how I am, I like to know WHY things work too. So I was thinking of another method... I know it sounds stupid, but hear me out Basically, I will take an angle, and draw an imaginary line with a slope that would make it appear to be pointing at the desired degree (ie: 45 degrees with a slope of 1. Then, I would go through my array and plot colored pixels (the image, obviously) with a slope perpendicular to that of the line. I will continue to do this until the entire image is drawn using the line as both a method of deciding how the rotation should look, as well as a midline for the image. Does this make any sense at all? It sound good to me, but I''m a newbie and don''t know a whole lot; that''s why I''d like to check with people who actually know Thanks in advance! :D

##### Share on other sites

Allow me to explain why it works: ( it
got me wondering at one point too )

Thinking linear algebra...

we have one vector, the vector we wish
to rotate by theta given by

v1 = <x,y>

basic vector laws tell us that this
can be described like this as well

v1.x = RcosF
v1.y = RsinF

where R is the vector length and F is
the angle of the vector

and then we have v2 the resultant
vector of the rotation
given by

v2.x = Rcos(F+T)
v2.y = Rsin(F+T)

R is the same as before and T is the
angle to rotate by expansion using one
of the trigonometric identities:

v2.x = R( cosFsinT - sinFcosT )
= RcosFsinT - RsinFcosT

now looking back RcosF = v1.x and
RsinF = v1.y so

v2.x = v1.x * sinT - v1.y * cosT

you follow the same idea (only
expanding sin instead of cos) to find
the y value of the new vector.

I know this wasnt your question but i
couldnt resist :>

later

ps ... why cant i post using lynx (or links) or konquerer (from my zaurus) ?!

1. 1
2. 2
Rutin
19
3. 3
4. 4
khawk
14
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633743
• Total Posts
3013644
×