import sk.uniba.fmph.pocprak.simplegraphics.*;
import java.awt.Color;
public class Pokus3 {

  public static void main(String[] args) {
    Killer.createKiller();

    Kreslic krxy = new Kreslic(new GrAxisX(0, 1, 0), new GrAxisY( -1., 1., 0));
    krxy.gr.setUserFrameSize(0.5, 0., 1., 1.);
    krxy.nakresliOsi();
    krxy.gr.repaint();
    double L = 1.;
    IntegrablePath f0 = new IntegrablePath();
    f0.addPoint(new point(0.,0.));
    f0.addPoint(new point(1.,0.));
    System.out.println("Naklikajte mysou body krivky");
    f0.addMousePoints(krxy.gr);
    f0.makeDense(1000);
    f0.draw(krxy.gr);
    krxy.gr.repaint();


    krxy.gr.setPaint(Color.red);
    Fourier fou = new Fourier(5,L);
    fou.makeTransform(f0);
    for(double x=0; x<1.; x+=0.001){
      krxy.gr.drawPoint(x,fou.fcn(x));
    }
    krxy.gr.repaint();

    krxy.gr.setPaint(Color.blue);
    Fourier fou1 = new Fourier(10,L);
    fou1.makeTransform(f0);
    for(double x=0; x<1.; x+=0.001){
      krxy.gr.drawPoint(x,fou1.fcn(x));
    }
    krxy.gr.repaint();

    krxy.gr.setPaint(Color.green);
    Fourier fou2 = new Fourier(50,L);
    fou2.makeTransform(f0);
    for(double x=0; x<1.; x+=0.001){
      krxy.gr.drawPoint(x,fou2.fcn(x));
    }
    krxy.gr.repaint();


  }
}
