A piece of code to visualise what I'm trying to do:
environment = [-100,-100; 100,-100; 100,100; -100,100; -100,-100];
pointA = [20,20];
pointB = [-100,50];
figure
impoly(gca,environment)
hold on
plot(pointA(1),pointA(2),'ko')
plot(pointB(1),pointB(2),'ro')
plot([pointA(1) pointB(1)],[pointA(2) pointB(2)]);
axis([-110,110,-110,110])