/**
This class stores 2-dimensional Vector. Coordinates are double x1, x2
@author Vaclav Tesinsky
*/
class Vector {
	double x1, x2;
	
/**
Constructs zero vector (0,0)
*/	
	public Vector() {
		x1 = 0;
		x2 = 0;
	}

/**
Constructs vector (x1,x2)
@param x1	 x coordinate
@param x2  y coordinate
*/		
	public Vector( double x1, double x2 ) {
		this.x1 = x1;
		this.x2 = x2;
	}
	
/**
Substracts vector v1 - v2
@param v1	 first vector
@param v2 second vector
@return Vector (v1 - v2)
*/
	public static Vector minus( Vector v1, Vector v2 ) {
		Vector v = new Vector( v1.x1 - v2.x1, v1.x2 - v2.x2 );
		return v;
	}
	
/**
Converts vector in caretsian coordinates into vector in polar coordinates
@param v1 vector in cartesian coord.
@return vector in polar coord.
*/
	public static Vector cart_2_pol( Vector v1 ) {
		Vector v = new Vector( Math.sqrt( v1.x1*v1.x1 + v1.x2*v1.x2 ), Math.atan2( v1.x2, v1.x1 ) );
		return v;
	}

/**
Converts vector in polar coordinates into vector in cartesian coordinates
@param v1 vector in polar coord.
@return vector in cartesian coord.
*/
	public static Vector pol_2_cart( Vector v1 ) {
		Vector v = new Vector( v1.x1 * Math.cos( v1.x2 ), v1.x1 * Math.sin( v1.x2 ) );
		return v;
	}
}