import java.awt.*;

import java.applet.*;



// Napier-Snibbe Remix: 

// Using object-oriented programming

// to combine aspects of two

// artistic styles.

// key:

//     Following Mark Napier's code

//     Following Scott Snibbe's code

//     My code is in gray.



// Requires Scott's Tripolar.class and Mark's Bitmap255.class.



// Remixed by Martin Wattenberg, Aug. 28 2002.



public class NapierSnibbe extends Tripolar {



    Bitmap255 BMP;

    long counter;

	

    public void init()

    {

        super.init();

        BMP = new Bitmap255(size().width, size().height);

        BMP.init();

    }

    

    void drawNormalizedLine(double x1, double y1, 

                            double x2, double y2, Graphics g) 

    {

        BMP.drawLine((int) Math.round(x1 * scale_ + centerX_),

            (int) Math.round(y1 * scale_ + centerY_),

            (int) Math.round(x2 * scale_ + centerX_),

            (int) Math.round(y2 * scale_ + centerY_));

    }

     

    public void paint(Graphics g)

    {

        if (probeX_ != 1e10) {

            updatePaths((probeX_ - centerX_) / scale_,

            (probeY_ - centerY_) / scale_, offScrGC_);

        }

        BMP.paint(g);

        if (++counter%1200==0) 

            BMP.targetColorValue = 255f-BMP.targetColorValue;

    }

}