With the origin for the rotations down, next came perfecting the amount of rotation, and the scaling down of each element. To make it difficult, coding seems to use radians rather than degrees, and boy does it make it annoying having to think back to high school math to remember the basics of radians. (PI = 180 degrees, PI/2 = 90 degrees, PI/4 = 45 degrees).
Achieving the correct scaling was achieved through the use of Pythagoras, again going back to high school math. As the new width and height of the rect() was to be half the length of the hypotenuse, the initial length had to undergo the following code: (sqrt(width*width + height*height))/2. This resulted in the new length for the next rect(). Compiled into a while() function with the rotation and rect() codes, the above pattern was formed.
No comments:
Post a Comment