/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Example.java
 *
 * Created on Mar 13, 2010, 2:46:54 PM
 */
/**
 *
 * @author siva
 */
//changed by M. Turhan Coban
import java.awt.*;
import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.BorderLayout;
import java.awt.FlowLayout;

class f1 extends f_xy
{
public double func(double x,double y) 
{
 double ff=(float)(x * Math.sin(y)*Math.random());
return ff; //minimum değil maxsimum istendiğinden - ile çarptık
}
}

class f2 extends f_xy
{
public double xy[][];
public double z[];
int n;
public f2(double xyi[][],int ni)
{	double a[][]=xyi;
    double b[][]=Text.T(a);
	double c[][]={b[0],b[1]};
	double b1[][]=Text.T(c);xy=b1;
	z=b[2];
	n=ni;
}

public double func(double x,double y) 
{ double xx[]={x,y};
	double ff=NA129H.HEKK(xx,xy,z,n);
 return ff; //minimum değil maxsimum istendiğinden - ile çarptık
}}


public class surfacePlot1 extends javax.swing.JFrame {
	    ExampleSurfaceModel1 model;
	    SurfaceCanvas canvas;
	    JPanel southPanel;
	    Container c;
        public void plot()
        {
	    c=this.getContentPane();
        c.setLayout(new BorderLayout());
        southPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 50, 5));
        southPanel.add(new JLabel("Rotate: Mouse Click & Drag"));
        southPanel.add(new JLabel("Zoom: Shift Key + Mouse Click & Drag"));
        southPanel.add(new JLabel("Move: Control Key + Mouse Click & Drag"));
        add(southPanel, BorderLayout.SOUTH);
	    this.setSize(1000,1000);
	    add(canvas, BorderLayout.CENTER);
	    this.repaint();
	    this.setVisible(true);
    }
    
    public surfacePlot1(f_xy f,double x0,double xn,double y0,double yN,double z0,double zN,
	String xLabel, String yLabel,String zLabel) 
    {   model = new ExampleSurfaceModel1(f,x0,xn,y0,yN,z0,zN,xLabel,yLabel,zLabel);
	    canvas = new SurfaceCanvas();
	    canvas.setModel(model);
	    canvas.setSize(1000,1000);
	    canvas.setVisible(true);
	    
	}

    public static void main(String args[]) {
	    double a[][]=Text.readDouble("a.txt");
	    f2 f=new f2(a,4);
	    surfacePlot1 p=new surfacePlot1(f,0.0,5.0,-5.0,5.0,0.0,10.0,"X","Y","Z");
        p.plot();
        
        //f1 ff=new f1();
        //surfacePlot1 p1=new surfacePlot1(ff,0.0,5.0,-5.0,5.0,-10.0,10.0,"X","Y","Z");
        //p1.model.setCalcDivisions(100);
        //p1.model.setDispDivisions(100);
        //p1.plot();
        
    }
}