3
$\begingroup$

I'm trying to write out the steps in code for deriving the 2D coordinate rotation formula so I can understand it.

x = radius * cos(angle) y = radius * sin(angle) x1 = radius * cos(angle + -rotation) y1 = radius * sin(angle +  rotation) 

So,

x1 = radius * cos(angle) * cos(rotation) – radius * sin(angle) * sin(rotation) y1 = radius * sin(angle) * cos(rotation) + radius * cos(angle) * sin(rotation) 

Therefore,

x1 = cos(rotation) * x – sin(rotation) * y y1 = cos(rotation) * y + sin(rotation) * x 

I hate to post a question just asking "Is this right?", but is this right? In particular, I'm unsure if I'm correctly representing the w (as listed in the link) in the first x1 and y1 assignment, and it's expansion. And no, this isn't homework. Thanks.

  • 0
    Thanks. Though that site seems a bit intimidating, especially to ask them to check my plus and minus signs.2011-09-03

2 Answers 2