%draw a closed 3d polygon
function polygon3(points)
    x = [points(1,:), points(1)];
    y = [points(2,:), points(2)];
    z = [points(3,:), points(3)];
    plot3(x, y, z, '.-');