Computing triangle repetition

For me, it's easy to make textiles in Illustrator. I originally started coding this pattern thinking it will be a piece of cake. It sure wasn't as easy as illustrator! I learned to change my cartesian coordinates to polar coordinates, used sin() and cos(), made two classes have different repetition. What an enthralling beginning of a project! I am glad I got my system laid out. Very excited to play with images inside these triangles and use random functions.

Here is my code on Git:

Screen Shot 2013-03-06 at 10.06.43 PM.png

This was my base template that I referenced. Rotating seems so easy when you are just looking at it right?