Fractal Journeys: A JavaFX Exploration

Fractal Journeys: A JavaFX Exploration

Fractals have always fascinated me, especially the Mandelbrot set. While I always wanted to code my own, my legendary laziness usually gets the better of me. Seeing beautiful fractals online always made me want to try. Now, with powerful language models (LLMs), I can generate code with prompts and then tweak it for interesting results!

Today, I decided to create a Mandelbrot fractal using JavaFX and the help of Gemini, which seems to be the most up-to-date LLM I've used.

Let's break down the Mandelbrot algorithm:

  • Imagine a complex maze. You can't see the walls, but you explore by starting at a point representing a complex number.

  • Square and add: Square the distance from your starting point (0, 0) and add a complex number that represents your location in the maze.

  • Repeat or escape: Do this over and over. If the distance keeps ballooning, the point is outside the Mandelbrot set. If it stays bounded, it's likely inside.

While I could explain more, let's get to the fun part! I managed to create a JavaFX Mandelbrot explorer with zooming and dragging. Gemini helped me generate the code, which you can find in this GitHub repo: https://github.com/rokon12/Mandelbrot.

I'm not 100% sure if the code is accurate, as I haven't paid much attention to it, but the result amazes me!

Initial view of the Mandelbrot set.

Zoom further

Further, zoom in
Zoom in more
Amazing! Could you please zoom in further?
I could keep zooming in forever, it seems.

Feel free to review the source code and suggest improvements.

That's all for today!

Happy Coding!

Sadat Rafsanjani

Software Engineer | System Designer | Open-Source Contributor | #Java #Python #AI

9mo

Stupid post

Like
Reply

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics