var Vector = new Class({
	initialize: function(x, y) {
		this.x = typeof(x)!="undefined" ? x : 0;
		this.y = typeof(y)!="undefined" ? y : 0;
	},
	
	copy: function(vec) {
		this.x = vec.x;
		this.y = vec.y;
	},
	set: function(x, y) {
		this.x = x;
		this.y = y;
	},
	
	add: function(vec) {
		return new Vector(this.x+vec.x, this.y+vec.y);
	},
	add_ip: function(vec) {
		this.x += vec.x;
		this.y += vec.y;
		return this;
	},
	
	sub: function(vec) {
		return new Vector(this.x-vec.x, this.y-vec.y);
	},
	sub_ip: function(vec) {
		this.x -= vec.x;
		this.y -= vec.y;
		return this;
	},
	
	mul: function(num) {
		return new Vector(this.x*num, this.y*num);
	},
	mul_ip: function(num) {
		this.x *= num;
		this.y *= num;
		return this;
	},
	
	div: function(num) {
		return new Vector(this.x/num, this.y/num);
	},
	div_ip: function(num) {
		this.x /= num;
		this.y /= num;
		return this;
	},
	
	len: function() {
		return Math.sqrt(this.x*this.x + this.y*this.y);
	}
});
