[comp.lang.pascal] R:Dewdney Algorithm for Cat Scanners

highley@sapphire.idbsu.edu (Larry Highley) (03/23/91)

In Scientific American (September 1990) there is an article by A.K. Dewdney
on Mathematical Recreations.  It involves the use of Digital X rays or 
D rays as he calls them.  He goes on to give an algorithm for writing a 
program which is capable of scanning simple images from a set of 
D--rays which are both horizontal and vertical.  He also mentions Diagonal
D-rays.  I was wondering if anyone had actually written the program
and if so if I could have a look at it.  I would also be interested in
any help people can give since I'm relatively new to this.  Here is the   
algorith he provides.

	input x-array and y-array
	input xcount and ycount
	repeat
		done<--0
		for each array position I
		if x-array(I)=ycount and done=0
		then x-array(I)<--0
			for each y-array(J)>0
				decrement y-array(J)
				color square at (I,J)
			done<--1
		if y-array(I)<--0
			for each x-array(J)>0
			 	decrement x-array(J)
				color square at (J,I)
			done<--1
		compute new xcount and ycount
	until count =0

I could use any help possible.
Thanks!!:)