Class Fractal

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class Fractal extends JRootPane implements ActionListener
Application which calculates fractals using a multithreaded system. The formula define the fractals uses complex numbers the default is z = z^2 + c, the c value is given by the coordinates of the individual pixels, and the color depends on the number of iterations it takes before the value diverges. The equation of the fractal can be changed, but must only use the variables z and c. The formula for colors can also be changed. The default is [ (itts % 10)/10 ,( itts % 100)/100, (itts % maxItts)/ maxItts ] the result of evaluation should be a vector with three item which values between 0 and 1. The formula for colors can contain z and c as well as itts the number of itts before divergence maxItts the maximum number of iterations specified. This value is set in a field in the main window. For example if(itts==maxItts, [0,0,0], [ (re(z) + 4)/8, (4-re(z))/8, (im(z)+4)/8] ) colors by the position of z after the iteration, or black if it did not converge.

The default region shown is (-2,-2) .. (2,2). Double-clicking zooms in centered on the mouse position, right-clicking zooms out, and dragging the mouse shifts the domain.

For details on how the thread are implement see the FractalCanvas class. See main thread documentation.

See Also:
  • Constructor Details

    • Fractal

      public Fractal()
  • Method Details

    • init

      public void init()
      Initializes the applet Fractal
    • showStatus

      public void showStatus(String line)
    • showProgress

      public void showProgress(String line)
    • actionPerformed

      public void actionPerformed(ActionEvent ae)
      Specified by:
      actionPerformed in interface ActionListener
    • main

      public static void main(String[] argv)