import java.applet.*;
import java.awt.*;

public class Engine3D extends Applet implements VKSRequest
{

	public FuncInterpret func;
	public String funcText = new String("-2.0*cos(sqrt(x^2+y^2))");
//	public String funcText = new String("exp(x)");

	public Engine3D()
	{
	}

	public String getAppletInfo()
	{
		return "Name: Engine3D\r\n" +
		       "Author: VoLcAnO\r\n" +
		       "Created with Microsoft Visual J++ Version 1.0";
	}


	public void init()
	{
		func = new FuncInterpret(funcText, this);

		Dimension area = new Dimension(350,350);
		VKSGraph vks11 = new VKSGraph(area, this);
		vks11.setCenter(290,100,0); // redundant. Performed automatically.
									//Use only in there is REAL a need to
									//override default behaviour.
		vks11.setLimits(-10,10,-10,10,0,20);

//######################################################
//
//	All of the functions below can be called in case
//	the default values are not satisfactory. They override
//	the default behaviour. In this example most of the
//	functions 'override' the default values with the same
//	values. They are just to show that they exist and
//	give some idea about what they are.
//
//######################################################
		
//		vks11.setLimits(-1,1,-1,1,0,20);
//		vks11.setScale(50,50,1.5);
//		vks11.setSteps(.2,.2);
//		vks11.setTicks(.7,.7,.8);

		
		
		
		vks11.setSteps(1,1);
		vks11.setScale(10,10,1.5);
		vks11.setTicks(3.3,3.7,2.1);
		vks11.setAngles(36,204);
		vks11.setPerspective(10000); //minimize effect
		vks11.setStyle(VKSGraph.DRAW_BOTH);
		vks11.setRGBScheme(0,0,255);
		vks11.setBgColor(Color.gray);
		vks11.setNetColor(Color.black);
		vks11.setAxisColor(Color.black);
		vks11.adaptLimits(true);
		vks11.drawAxes(true);
		vks11.labelAxes(true);
		vks11.autoLocate(true);
		vks11.setBorders(10, 10, 10, 10);
		vks11.setAxisGap(0.05); //5%
		vks11.setAxisProportion(0.3); //30%
		vks11.setMouseSensitivity(1.0); //normal
		vks11.axesLabels("X Axis description goes here",
						 "Y Axis description - here",
						 "Z Axis Description is here... box is auto-sized");
        add(vks11);


	}

	public void destroy()
	{
	}

	public void paint(Graphics g)
	{

	}

	public void start()
	{
	}
	
	public void stop()
	{
	}

	public double getZ(double x, double y)
	{
		return func.interpret(x, y);
	}

	public String trimTickLabels(double param)
	{
		String tempStr = new String("aa");;
		tempStr = Double.toString(param);
		if(tempStr.length() >= 5)
			tempStr = tempStr.substring(0,4);
		return tempStr;
	}

}

