What you are doing is rotating starting vector by 10 degrees, then rotating starting vector by 20 degrees and so on...
What my code does is rotate starting vector by 10 degrees, then rotate vector returned by previous operation by another 10 degrees and so on...
The general formula for rotation is:
new_x = x*cos(angle) - y*sin(angle)
new_y = x*sin(angle) + y*cos(angle)
and as you can see the formula you used is simply a special case of general formula:
PHP Code:
x = 70*floatcos(g_deg, degrees) - 0*floatsin(g_deg, degrees);
y = 70*floatsin(g_deg, degrees) + 0*floatcos(g_deg, degrees);
Since I use the same angle in every operation, I could cache values of sin and cos and I stored them in a matrix.
2D transformations are usually done using 3x3 matrix, but since we need only rotation, then 2x2 was enough for that.
__________________