2D RotationBy Dag, on December 22nd, 2016
Click the '@' to begin.
\---@---\By Dag Jonny Nedrelid, 13th December 2007.
View the source to see the code.
This script uses sine and cosine to perform a 2D rotation. These are trigonometric functions to measure the ratio between the hypotenus and the adjacent, or opposed line from θ. sine and cosine can be calculated in 2 ways, either dividing lines with hypotenus, or through feeding a calculating function the θ. In this script the rotation is made around the 'would be' z-axis in a 3D environment. As we keep looping the angle θ value in radian up to 2π(6.28)(360°), sine and cosine relationship/ratio values will keep changing accordingly.
When you want to now the exact length of the θ's opposite line, you multiply hypotenus with its sine, in our case the coordinate Y. Multiply hypotenus with cosinus, and you get the actual length of the adjacent line as well, in our case the coordinate X. Hypotenus becomes the range(line) from θ to the coordinates X/Y, ie. the radius.