08
May
04

4D Quaternion Julia Set

This is by far the most popular method for creating hypercomplex fractals. Here is some Mathematica code:
(* runtime: 1.5 minutes *)
n = 100; dx = 3/n; qc = {-0.2, 0.8, 0, 0}; Norm[q_] := q.q;
Square[{x_, y_, z_, w_}] := {x^2 - y^2 - z^2 - w^2, 2 x y, 2 x z, 2 x w};
Julia[q0_] := Module[{q = q0, i = 0}, While[i < 12 && Norm[q] < 4, q = Square[q] + qc; i++]; i];
image = Table[z = 1.5; While[z > -1.5 && Julia[{x, y, z, 0}] < 12, z -= 3/n]; z, {y, -1.5, 1.5, dx}, {x, -1.5, 1.5, dx}];
ListDensityPlot[image, Mesh -> False, Frame -> False]

We can use fast Phong shading to make it look 3D:
(* runtime: 0.3 second *)
Normalize[x_] := x/Sqrt[x.x];
ListDensityPlot[Table[x = (j - 1) dx - 1.5; y = (i - 1) dx - 1.5; z = image[[i, j]]; normal = Normalize[{(image[[i, j + 1]] - image[[i, j - 1]])z, (image[[i + 1, j]] - image[[i - 1, j]]) z, 2dx}]; L = {1, 1, 0} - {x, y, z}; reflect = Normalize[2(normal.L)normal - L]; -(normal.Normalize[L] + reflect[[3]]), {i, 2, n}, {j, 2, n}],Mesh -> False, Frame -> False]

POV-Ray has an efficient algorithm for ray tracing quaternion Julia sets:
// runtime: 8 seconds
camera{location <1,1,-2> look_at 0}
light_source{<1.5,1.5,-1.5>,1}
julia_fractal{<-0.2,0.8,0,0> quaternion sqr max_iteration 12 precision 400 pigment{rgb 1}}

Links

Advertisements

0 Responses to “4D Quaternion Julia Set”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Welcome !

You will find here some of my favorite hobbies and interests, especially science and art.

I hope you enjoy it!

Subscribe to the RSS feed to stay informed when I publish something new here.

I would love to hear from you! Please feel free to send me an email : bugman123-at-gmail-dot-com

Archives

Blog Stats

  • 548,959 hits

%d bloggers like this: