If I have a Vector, say (1,1), how can I rotate it around the origin (0,0)?
I'm working in XNA if that helps.
|
If I have a Vector, say (1,1), how can I rotate it around the origin (0,0)? I'm working in XNA if that helps. |
|||||||
|
|
Just multiply the vector by a rotation matrix:
where |
|||
|
|
|
Since you are using XNA, there is an easy way to do the above, which can be found in this following thread. In shows how to perform the transformation in 3D or 2D. For 2D, it is as simple as:
Note that AngleToRotate is in radians. If you want to use Degrees you can can take advantage of
which is a static method. |
|||
|
|