Posts Tagged ‘Java

18
Feb
05

Cubic Julia Set Fractal

zn+1 = zn3+zc, zc = -0.5-0.05i
This was one of my older favorites.

original version: Java, 6/9/01;
animated version: Mathematica 4.2, 2/18/05

(* runtime: 10 seconds *)
Julia = Compile[{{z, _Complex}}, Length[FixedPointList[#^3 + zc &, z, 100, SameTest -> (Abs[#] > 2 &)]]];
zc = -0.5 - 0.05 I;
DensityPlot[Julia[x + I y], {x, -1.15, 1.15}, {y, -1.15, 1.15}, PlotPoints -> 275, Mesh -> False, Frame -> False, ColorFunction -> (RGBColor[Min[2#^2, 1], Max[2# - 1, 0], Min[2#, 1]] &)];

This is how you can make this fractal in POV-Ray:
// runtime: 0.5 second
camera{orthographic location <0,0,-1.15> look_at 0 angle 90}
plane{z,0 pigment{julia <-0.5,-0.05>,30 exponent 3 color_map{[0 rgb 0][1/3 rgb <0,0,1>][2/3 rgb <1,0,1>][1 rgb 1]}} finish{ambient 1}}

16
Feb
05

Mandelbrot Set Zoom

zn+1 = zn2+zc
This animation zooms in on the Mandelbrot set by a factor of 1015. At this high resolution, double precision numbers are inadequate. Therefore, this animation was created using “double-double” precision numbers, adapted from Keith Brigg’s double-doubles. See also my Java program and C program.

Mandelbrot Set Zoom – original version: Java, 5/24/01; animated version: C++, 2/16/05 Here is some Mathematica code for this fractal:
(* runtime: 1 minute *)
Mandelbrot[zc_] := Module[{z = 0, i = 0}, While[i < 100 && Abs[z] < 2, z = z^2 + zc; i++]; i];
DensityPlot[Mandelbrot[xc + I yc], {xc, -2, 1}, {yc, -1.5, 1.5}, PlotPoints -> 275, Mesh -> False, Frame -> False, ColorFunction -> (If[# != 1, Hue[#], Hue[0, 0, 0]] &)];

Here is a faster version:
(* runtime: 7 seconds *)
Mandelbrot = Compile[{{zc, _Complex}}, Length[FixedPointList[#^2 + zc &, zc, 100, SameTest -> (Abs[#] > 2 &)]]];
DensityPlot[Mandelbrot[xc + I yc], {xc, -2, 1}, {yc, -1.5, 1.5}, PlotPoints -> 275, Mesh -> False, Frame -> False, ColorFunction -> (If[# != 1, Hue[#], Hue[0, 0, 0]] &)];

POV-Ray has a built-in function for this fractal:
// runtime: 0.5 second
camera{orthographic location <-0.5,0,-1.5> look_at <-0.5,0,0> angle 90}
plane{z,0 pigment{mandel 100 color_map{[0 rgb 0][1/6 rgb <1,0,1>][1/3 rgb 1][1 rgb 1][1 rgb 0]}} finish{ambient 1}}

Links

16
Aug
04

Plasma Fractal

Plasma Fractal – adapted from Justin Seyster’s Plasma Java applet. This code generates non-periodic random textures using a bisection method. This is another popular technique for generating terrain.
(* runtime: 19 seconds *)
n = 256; image = Table[0, {n}, {n}];
Plasma[w_, {x_, y_}, {{a_, c_}, {g_, i_}}] := If[w < 2, image[[y + 1, x + 1]] = (a + c + g + i)/4, Module[{b = (a + c)/2, d = (a + g)/2, e = Min[Max[(a + c + g + i)/4 + 1.5 (Random[] - 0.5) w/n, 0], 1], f = (c + i)/2, h = (g + i)/2}, Plasma[w/2, {x, y}, {{d, e}, {g, h}}]; Plasma[w/2, {x + w/2, y}, {{e, f}, {h, i}}]; Plasma[w/2, {x, y + w/2}, {{a, b}, {d, e}}]; Plasma[w/2, {x + w/2, y + w/2}, {{b, c}, {e, f}}]]]; Plasma[n, {0, 0}, Table[Random[], {2}, {2}]];
ListDensityPlot[image, Mesh -> False, Frame -> False, ColorFunction -> Hue];

22
May
01

Web – Java applet

Web – Java applet : This was the first “complex” fractal I ever made. I accidentally made this fractal while trying to generate the Mandelbrot Set. Unfortunately, I don’t remember how to make it. Please let me know if you figure it out! I think the original code went something like this:
(* runtime: 38 seconds *)
Web[xc_, yc_] := Module[{x = 0, y = 0, i = 0}, While[i < 100 && (x^2 + y^2) < 4, x = x^2 - y^2 + xc; y = 2x y + yc; i++]; i];
DensityPlot[Log[Web[xc, yc]], {xc, -2, 1}, {yc, -1.5, 1.5}, PlotPoints -> 275, Mesh -> False, Frame -> False, ColorFunction -> (If[# == 1, Hue[0, 0, 0], Hue[0,Min[1, 2(1 - #)], Min[1, 2#]]] &)];




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

  • 546,315 hits