/**
 * 
 * Copyright 2010 Paul Scherrer Institute. All rights reserved.
 * 
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This code is distributed in the hope that it will be useful,
 * but without any warranty; without even the implied warranty of
 * merchantability or fitness for a particular purpose. See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this code. If not, see <http://www.gnu.org/licenses/>.
 * 
 */

package ch.psi.plot.xyz.generator;

/**
 * Generator function that is generating a spherical wave
 * @author ebner
 *
 */
public class SphericalWave  implements XYZGeneratorFunction {
	
	private double centerX;
	private double centerY;
	private double kx;
	private double ky;
	private double amplitude;
	
	/**
	 * Constructor - Default constructor using default values for the wave
	 */
	public SphericalWave(){
		this(5.0, 5.0, 1.0, 1.0, 1.0);
	}
	
	/**
	 * Constructor
	 * @param centerX
	 * @param centerY
	 * @param kx
	 * @param ky
	 * @param amplitude
	 */
	public SphericalWave(double centerX, double centerY, double kx, double ky,double amplitude){
		this.centerX = centerX;
		this.centerX = centerX;
		this.kx = centerX;
		this.ky = centerY;
		this.amplitude = amplitude;
	}

	
	@Override
	public double generate(double x, double y) {
		return amplitude*Math.pow(Math.sin( Math.pow(kx*(x-centerX),2.0) + Math.pow(ky*(y-centerY), 2.0)) ,2.0);
	}
}
