package ei.engine.math;

/**
 * This class holds 3 float values 
 * 
 * @author Ziver
 */

public class Vector3f {
	private float x;
	private float y;
	private float z;
	
	/**
	 * Creates a vector whit the value zero
	 */
	public Vector3f(){
		this(0,0,0);
	}
	
	/**
	 * Creates a Vector by the given values
	 * 
	 * @param x The x value
	 * @param y The y value
	 * @param z The z value
	 */
	public Vector3f(float x, float y, float z){
		this.x = x;
		this.y = y;
		this.z = z;
	}
	
	/**
	 * Get the X value
	 * 
	 * @return the x value in the vector
	 */
	public float getX(){
		return x;
	}
	
	/**
	 * Get the Y value
	 * 
	 * @return the y value in the vector
	 */
	public float getY(){
		return y;
	}
	
	/**
	 * Get the Z value
	 * 
	 * @return the z value in the vector
	 */
	public float getZ(){
		return z;
	}
	
	/**
	 * Set the z value
	 * 
	 * @param z the z value
	 */
	public void setZ(float z){
		this.z = z;
	}
	
	/**
	 * Add to the vector
	 * 
	 * @param i The amount to add
	 */
	public void add(float i){
		x += i;
		y += i;
		z += i;
	}
	
	/**
	 * Add to the vector
	 * 
	 * @param i The amount to add
	 */
	public void add(Vector3f i){
		x += i.getX();
		y += i.getY();
		z += i.getZ();
	}
	
	/**
	 * Add to the vector
	 * 
	 * @param i The amount to add
	 */
	public void add(Vector2f i){
		x += i.getX();
		y += i.getY();
	}
	
	/**
	 * Add to the vector
	 * 
	 * @param x The value to add to the x value
	 * @param y The value to add to the y value
	 * @param z The value to add to the z value
	 */
	public void add(float x, float y, float z){
		this.x += x;
		this.y += y;
		this.z += z;
	}
	
	/**
	 * Returns a copy of this vector
	 * 
	 * @return A copy of this vector
	 */
	public Vector3f getCopy(){
		return new Vector3f(x,y,z);
	}
	
	public String toString(){
		return "Vector3f["+x+","+y+","+z+"]";
	}
}
