Mystic Roses
| Learning Graphics programming with OpenGL, C++. You can find the project by clicking the Github icon. -> |
Concept
A Mystic Rose is a beautiful, geometric image created by joined together points that are equally spaced along the circumference of a circle.
By selecting the number of points in your rose, you can determine the degree of rotation of each point/line. (360 deg / number of points)
The number of lines to be drawn to complete the rose can be calculated by the following formula:
Number of points * (Number of points - 1) / 2
Development and Code


Trigonometry to code; identifying points on the circle
By randomizing the number of points and the radius of the circle, I achieved a numerous random mystic roses animation. Using the math libraries, I picked a random positive point between the center and 50 units from the edge of the application window (margin).
Following the above trigonometric expressions, other points along the circle circumference were noted and stored. To avoid further complications of having the number of lines being counted and drawn accordingly, I used GL_LINE_STRIP attribute instead of a GL_LINE, to have a continous line drawn until the shape closed.
Action
Mystic Roses project

0 comments:
Post a Comment