//http://timestocome.com //Linda MacPhee-Cobb //Julia set // This is a fractal derived from the Mandelbrot fractual // In Mandelbot you use Z <- Z^2 + C where Z is set to zero and C is x + yi the point you are mapping // // In the Julia set you use Z <- Z^2 + C where C is a constant and Z is the x + yi point on the plane that you are mapping //Clicking your mouse in the window re-centers the view on your click //Hit the + key to double the size //Hit the - key to half the size import java.awt.*; import java.awt.event.*; import java.util.*; public class Julia extends Frame implements Runnable, WindowListener, MouseListener, KeyListener { // Globals int MAX = 500; //size of window in pixels double lowX, highX, lowY, highY; //range for Mandelbrot double x0, y0; //center of Mandelbrot function int max_iterations = 100; int iteration_array[] = new int[max_iterations]; // how many iterations for each number do we go through loop? public static void main ( String[] args ) { new Julia(); } //set up window and initial values public Julia() { //window set up super ( " Window Display " ); setBounds ( 0, 0, MAX, MAX ); setVisible ( true ); addWindowListener ( this ); addMouseListener ( this ); addKeyListener ( this ); //set up initial values lowX = -2.5; lowY = -2.5; highX = 2.5; highY = 2.5; x0 = 0.0; y0 = 0.0; for ( int i=0; i