.PS
linethick = 1
scale=2
pointrad=0.02
define point { circle filled 1 rad pointrad at ($1, $2); }
a=1
b=2
c=5
d=7
P: point(a,b)
Q: point(c,d)
line "|c-a|" "" from P to (c,b)
line " |d-b|" ljust from (c,b) to Q
"" "(a,b)" at P
"(c,d)" ljust at Q
t = 1/3
x= c * t + a * (1-t)
y= d * t + b * (1-t)
r=1
R: point(x,y)
line thickness 0 from (x-r, y) to (x, y-r) to (x+r, y) to (x, y+r) to (x-r, y)
"P" "" at R
z=rand();
line thickness 0 from (x, y) to (x+z, y) to (x+z, y+1-z)
circle rad pointrad/2 filled 1 at last line .end
z:=rand();
line thickness 0 from (x, y) to (x-z, y) to (x-z, y+1-z)
circle rad pointrad/2 filled 1 at last line .end
#z=rand();
#line thickness 0 from (x, y) to (x-z, y) to (x-z, y-1+z)
#circle rad pointrad/2 filled 1 at last line .end
z:=rand();
line thickness 0 from (x, y) to (x, y-1+z) to (x+z, y-1+z)
circle rad pointrad/2 filled 1 at last line .end
.PE