var Vector = Class.create({
	x: null,
	y: null,

	initialize: function(x, y) {
		this.x = x;
		this.y = y;
	},

	add: function(v1, v2) {
		return new Vector(v1.x + v2.x, v1.y + v2.y);
	},

	subtract: function(v1, v2) {
		return new Vector(v1.x - v2.x, v1.y - v2.y);
	},

	toPolar: function() {
		r = Math.sqrt(Math.pow(this.x, 2) + Math.pow(this.y, 2));
		angle = Math.atan2(this.y, this.x);

		return new Polar(r, angle);
	}
});

var Polar = Class.create({
	radius: null,
	angle: null,

	initialize: function(radius, angle) {
		this.radius = radius;
		this.angle = angle;
	},

	toVector: function() {
		x = this.radius * Math.cos(this.angle);
		y = this.radius * Math.sin(this.angle);

		return new Vector(x, y);
	}
});

