%draw a closed polygon
function polygon(points)
    %repeat first point at the end to "close" the polygon
    x = [points(1,:), points(1,1)];
    y = [points(2,:), points(2,1)];
    plot(x, y, 'y', 'LineWidth', 2);
    