Entry
Math: Transformation: 2D: Rotation: Rotation: Formula: Can you derive the 2D rotation formula?
Feb 1st, 2006 15:13
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden --- 01 February 2006 - 10:23 pm -------------------
Math: Transformation: 2D: Rotation: Rotation: Formula: Can you derive
the 2D rotation formula?
===
Method: follow the old legs of the triangle
Given
old:
X
|
|
xOld | yOld
O---------------------+
new:
X
\ yOld
\
\
/
/
/
/ xOld
/
O/ angle h
By turning the old triangle as a whole, like a rigid shop hook, over
an angle a,
the old X arrives in a new position.
---
Calculating the new x and the new y can
be done as follows:
---
You find the new x by adding the horizontal length1 together with
horizontal length2:
| X |
| |\ yOld
| |h \ |
| | \|
| | /|
| | / |
| / |
| /| xOld|
| / | |
O/ h | |
<---------->
length1 = xOld . COS(h)
<----->
length2 = yOld.SIN(h)
from the figure it shows that:
xNew = length1 - length2
or thus
+----------------------------------------+
|xNew = xOld . COS( h ) - yOld . SIN( h )|
+----------------------------------------+
Further,
You find the new y by adding the vertical height1 together with
vertical height2:
X------------
|\ yOld
|h \ height2 = yOld . COS( h )
| \
+------------
| /
|/ height1 = xOld . SIN( h )
/| xOld
/ |
O/h +------------
from the figure it shows that:
yNew = height1 + height2
or thus
+----------------------------------------+
|yNew = xOld . SIN( h ) + yOld . COS( h )|
+----------------------------------------+
===
Internet: see also:
---
Math: Transformation: Rotation: Link: Can you give an overview of
links?
http://www.faqts.com/knowledge_base/view.phtml/aid/39299/fid/1856
----------------------------------------------------------------------