p = [
    0 0 -10 1
    2 0 -10 1
    2 2 -10 1
    1 3 -10 1
    0 2 -10 1
    0 0 -10 1
    ];
p2 = [
p
p + [zeros(6,2) -4*ones(6,1) zeros(6,1)] 
];

points = [
    p2
    p2(8,:)
    p2(2,:)
    p2(3,:)
    p2(9,:)
    p2(10,:)
    p2(4,:)
    p2(5,:)
    p2(11,:)
    p2(12,:)
    p2(6,:)
    ];
translate = eye(4);
translate(4,1) = -1;
translate(4,2) = -1;
points = points*translate;
p = plot3(points(:,1), points(:,2), points(:,3), 'EraseMode', 'background');

hold on
axis([-5, 5, -5, 5, -15, 0]);
input('Press enter to continue')

project = eye(4);
project(3,4) = -1;
project(4,4) = 0

output = points*project

lastColumn = output.*[zeros(22,3) ones(22,1)];
lastColumn = lastColumn(:,4);
scaled = output.*[1./lastColumn 1./lastColumn 1./lastColumn 1./lastColumn]
clf
plot(scaled(:,1), scaled(:,2))
axis([-1 1 -1 1])