function Polygon(points) {
	this.points = points;
	this.filled = false;
	
	this.rotate = function(angle) {
		for (var i = 0; i < this.points.length; i++) {
			this.points[i].rotate(angle);
		}
	}

	this.draw = function(ctx, color) {
		ctx.beginPath();
		ctx.moveTo(this.points[0].x,this.points[0].y);
		for (var i = 1; i < this.points.length; i++) {
			ctx.lineTo(this.points[i].x,this.points[i].y);
		}
		ctx.lineTo(this.points[0].x,this.points[0].y);
		if (this.filled) {
			ctx.fillStyle=color;
			ctx.fill();
		} else {
			ctx.strokeStyle=color;
			ctx.stroke();
		}
	}
	
	this.translate = function(dx,dy) {
		for (var i = 0; i < this.points.length; i++) {
			this.points[i].translate(dx,dy);
		}		
	}
}
