We shall look at a typical (small) application using these
routines (plus one other) to draw a SQUARE. Most of our
algorithms will be in pseudo-code which should be easily
translated into FORTRAN/Pascal/C.
Example draw a square of side 8" centred on screen. Screen is 22" by 16.75"
and starts at X=1.5 and Y origin = 1.0. All plots are relative to origin.
program SQUARE
call export(stdin,stdout); {Allow library to use stdio.}
call askdev(device); {Which device to use?}
call start(2); {initialize device}
call plot(9.5,7.375,-3);
{Move, with origin reset : 9.5+1.5 = 11 = new X
7.375+1 = 8.375 = New Y
therefore CENTRE 22/2 16.75/2 }
call plot(4.0,4.0,3); {move to one corner}
call plot(4.0,-4.0,2); {draw} {(1)}
call plot(-4.0,-4.0,2); {(2)}
call plot(-4.0,4.0,2);
call plot(4.0,4.0,2); {all sides }
call enplot; {terminate devices}
end_program_square.