// import PlotAnimation;
import java.awt.Color;
import java.lang.Math;

public class welle_2_07 extends PlotAnimation
{
    public double welle(double x)
    {
	if( Math.abs(x) < 1.0 )
	    {
		double a=x+1.0;
		double b=1.0-x;
		return a*a*b*b*b;
	    }
	else
	    return 0.0;
    }

    public class Vorl_Med1 extends Plot.PlotFunction
    {
	public Vorl_Med1(){color=Color.green;}
	public double fy(double x, double t)
	{
	    return welle(x-t);
	}
    }
    public class Rueckl_Med1 extends Plot.PlotFunction
    {
	public Rueckl_Med1(){color=Color.blue;}
	public double fy(double x,double t)
	{
	    return -0.3333*welle(20-x-t);
	}
    }
    public class Vorl_Med2 extends Plot.PlotFunction
    {
	public Vorl_Med2(){color=Color.yellow;}
	public double fy(double x,double t)
	{
	    return 0.6666*welle(2.0*(x-0.5*t-5.0));
	}
    }
    public class Ey_Feld extends Plot.PlotFunction
    {
	public double fy(double x,double t)
	{
	    if( x < 10.0 )
		return welle(x-t)-0.3333*welle(20-x-t);
	    else
		return 0.6666*welle(2.0*(x-0.5*t-5.0));
	}
    }


    // Konstruktor:
    public welle_2_07()
    {
	set_x_range(7.7,12.3);
	set_y_range(-1.1,1.1);
	set_x_tics(8.0,1.0);
	set_y_tics(-1.0,0.5);
	set_t_range(7.0,13.0,0.07);
	graphs.addElement(new Vorl_Med1());
	graphs.addElement(new Rueckl_Med1());
	graphs.addElement(new Vorl_Med2());
	graphs.addElement(new Ey_Feld());
	// Grenzschicht:
	lines.addElement(new Line(10.0,-1.1,10.0,1.1));
    }
}



