Skip to content

An interactive application developed in C++ and SFML that visualizes the creation of beautiful roses through simple polar equations.

Notifications You must be signed in to change notification settings

tuananohut/Interactive-Mathematical-Rose-Visualization

Repository files navigation

Interactive Mathematical Rose Visualization

https://youtu.be/vepaVo9sTKY?si=pkr0jEDA_eNBYDOl

An interactive application developed in C++ and SFML that visualizes the creation of beautiful roses through simple polar equations.


Project Overview

Building upon the foundational principles of my "Trigonometry and Polar Coordinates" project, this application was created to explore the fascinating world of procedural art. The goal was to build an interactive tool that allows users to manipulate mathematical parameters in real-time and witness how simple formulas can generate intricate and aesthetically pleasing patterns. This project serves as a practical study in procedural generation and the power of mathematics in computer graphics.


Key Features & Implemented Concepts

  • Real-time Procedural Generation: The rose patterns are generated and drawn live on the screen, responding instantly to user input.
  • Interactive Parameters: Users can dynamically change the n and d integer values of the rose equation (k = n/d) to explore a vast catalog of different patterns.
  • Polar to Cartesian Conversion: Core to the visualization, the application continuously converts polar coordinates (radius, angle) into Cartesian coordinates (x, y) for rendering with SFML.
  • User Feedback: The current n (red) and d (blue) values are displayed on the screen, providing clear visual feedback to the user.

Rose-rhodonea-curve-7x9-chart-improved svg


What I Learned: From Simple Rules to Complex Beauty

This project was a profound lesson in the core principles of procedural generation.

  • Emergent Complexity: The most significant takeaway was seeing how a very simple set of rules—the polar equations—could produce an enormous variety of complex and unpredictable patterns. It was a tangible demonstration of how complexity can emerge from simplicity.

  • Connection to Graphics: This principle is fundamental in modern computer graphics. Procedural generation is used to create everything from realistic textures (like wood grain or marble) and natural landscapes to complex visual effects in games and film. This project provided a hands-on understanding of this powerful technique.

  • Building Interactive Tools: Beyond just implementing an algorithm, I learned to create an interactive experience. Designing the user input (n and d keys) and providing on-screen feedback was a great exercise in creating a simple but effective user interface.


How to Build & Run

This project was developed on Windows using Visual Studio 2022.

  1. Clone the Repository:
    git clone https://github.com/tuananohut/Interactive-Mathematical-Rose-Visualization.git
  2. Run from Visual Studio:
    • Open the .sln solution file in Visual Studio.
    • Set the solution configuration to Release and platform to x64.
    • Build and run the project (F5).
  3. Run Pre-compiled Executable:
    • Alternatively, you can run the pre-compiled .exe file located in the /x64/Release/ directory.
    • Note on Font Rendering: There is a known issue with the font failing to load in the current executable, which I plan to fix. The core visualization works perfectly.

Controls

  • Press the N key to increment the n value (shown in red).
  • Press the D key to increment the d value (shown in blue).

Acknowledgements

The mathematical concepts and inspiration for this project came from these excellent resources:

About

An interactive application developed in C++ and SFML that visualizes the creation of beautiful roses through simple polar equations.

Topics

Resources

Stars

Watchers

Forks

Languages