/*
 * 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 javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.BorderLayout;
import java.awt.FlowLayout;

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

class f2 extends f_xj
{
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 ff=NA129H.HEKK(x,xy,z,n);
 return ff; //minimum değil maxsimum istendiğinden - ile çarptık
}}


public class Example extends javax.swing.JFrame {

    public Example() {
        getContentPane().setLayout(new BorderLayout());

        JPanel 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"));
        getContentPane().add(southPanel, BorderLayout.SOUTH);

	setSize(1000,1000);
	double a[][]=Text.readDouble("a.txt");
	f2 f=new f2(a,4);
	ExampleSurfaceModel model = new ExampleSurfaceModel(f,0.0,10.0,-10.0,10.0,0.0,100.0,"X","Y","Z");
	SurfaceCanvas canvas = new SurfaceCanvas();
	canvas.setModel(model);
	getContentPane().add(canvas, BorderLayout.CENTER);
	canvas.repaint();
	setVisible(true);
    }

    public static void main(String args[]) {
        new Example().setVisible(true);
    }
}