Julia Set with Quaternions

edited April 2016 in Share Your Work

Hello. Fractals have been what I enjoy programming the most. This last time I've done some work with Julia Sets and quaternions. For those who don't know what Julia sets are they are some sort of iterative function using complex numbers, I will leave a like to the wiki page here: https://en.wikipedia.org/wiki/Julia_set

For those who don't know what Quaternions are they are sort of complex number, but with 4 dimensions instead of 2, and here is the link if you want to do some reading : https://en.wikipedia.org/wiki/Quaternion

To explain my work: I use the normal f(z)=z^2+c to iterate over z, but instead of it being a complex number now it is a quaternion, which gives me a 4d object instead of a 2d one that you normally get using the normal julia iteration. Next I fix the w coordinate and the z coordinate, having now a 2d slice of the 4d object. With the "a" and "d" keys you can slide along the z axis, but not the w. C also has 4 coordinates, let's call them a,b,c,d, and the values are displaying along side de drawing. You can change them by moving the mouse to the top, the bottom or the sides, and pressing. You can see how it works easily, basically the top changes the a coordinate, the bottom changes b, right changes c and left changes d.

If anyone has some ideas on how to draw the set straight to 3d and wants to discuss some maths I would gladly appreciate it; any improvements on my code are also welcome.

I leave the code here: http://pastebin.com/E532V1GJ

Have a nice day and thanks for your time.

Comments

  • hm, you need to get to xyz somehow- the 4th could just be the time axis, so it changes over time?

    also of course you can interprete the data as angles t & phi and radius

    But there are ways to transform quaternion to 3D, no?

    Could you post some images of your work please?

  • The images are just 2d slices of the 3d object i'm creating by slicing the 4d object that the quaternion gives me. I can make the 2d slices move over the axis that's left from the 3d object using the keyboard, I just cant draw it straight through 3d because of the way I'm doing the maths, i'm not even sure that processing can handle it. I will post a imgur album tomorrow if you are interested still

  • Sorry for not replying yesterday. Here's the link imgur.com/a/5mrzC. You are welcome to copy paste the the pastebin an run the code yourself to see what it can do

  • It looks amazing!!!

    Thank you!!

  • I just started on Processing this week, and it has been about twenty years since I studied maths, so my thoughts might be off-track but — if you can identify points inside the set, the point(x,y,z) function would plot them.

    Will a point cloud reveal the set shape, though? Perhaps it'd be better to plot tiny spheres and apply a shader.

    How are you identifying set elements?

    There might be some short-cut like looking for set elements close to the viewer, and deducing that they block the view to other points that therefore don't need to be tested.

    I'd be interested to see how you're testing whether points belong to the set.

  • A simple and old-fashioned idea (which may be too simple to work) — can you scan across the field of view, testing points along each visual ray until you find the closest?

Sign In or Register to comment.