	PROGRAM TEST3D
C	PARAMETER NX=31, NY=31
	COMMON /GCDCHR/ DEVID, XLENCM, YLENCM, XRES, YRES,
	1   NDCLRS, IDVBTS, NFLINE, XCLIPD, YCLIPD
	BYTE LINE(10)
C	DIMENSION Z(NX,NY),XYLIM(2,6),CAMLOC(3)
	DIMENSION Z(31,31),XYLIM(2,6),CAMLOC(3)
C	BYTE IZ(NX,NY)
	BYTE IZ(31,31)
C
	EQUIVALENCE (XYLIM(1,1),XMIN),(XYLIM(2,1),XMAX),
	1  (XYLIM(1,2),YMIN),(XYLIM(2,2),YMAX),
	2  (XYLIM(1,3),ZMIN),(XYLIM(2,3),ZMAX),
	3  (XYLIM(1,5),WIDTH),(XYLIM(2,5),HEIGHT),
	4  (XYLIM(1,6),XOFF),(XYLIM(2,6),YOFF)
C
	DATA NX /31/
	DATA NY /31/
	DATA XMIN,XMAX,YMIN,YMAX /-10.0,10.0,-10.0,10.0/
C
C
C
	TYPE 1
1	FORMAT('$ENTER DIGLIB DEVICE NUMBER: ')
	ACCEPT 2, IDEV
2	FORMAT(I5)
	CALL DEVSEL(IDEV,4,IERR)
	DX = (XMAX-XMIN)/(NX-1)
	DY = (YMAX-YMIN)/(NY-1)
	ZMIN=1E30
	ZMAX=-1E30
	DO 65 I=1,NX
	X = XMIN + (I-1)*DX
	DO 60 J=1,NY
	Y = YMIN + (J-1)*DY
	Z(I,J) = FXY(X,Y,0.0,0.0,15.0,10.0) +
	1   0.9*FXY(X,Y,-5.0,-2.5,10.0,20.0) +
	1   0.75*FXY(X,Y,7.0,3.0,20.0,20.0) +
	2   0.85*FXY(X,Y,2.0,-4.0,15.0,15.0) +
	2   0.85*FXY(X,Y,-2.5,6.5,25.0,35.0)
	ZMIN=AMIN1(ZMIN,Z(I,J))
60	ZMAX=AMAX1(ZMAX,Z(I,J))
65	CONTINUE
	XYLIM(1,4)=1.0
	XYLIM(2,4)=1.0
85	WIDTH = XLENCM-1.0
	HEIGHT = YLENCM-1.0
	XOFF = 0.5
	YOFF = 0.5
100	TYPE 120
120	FORMAT(1X,'RELATIVE CAMERA POSITION - R,PHI,THETA')
	ACCEPT 150, CAMLOC(1),CAMLOC(2),CAMLOC(3)
150	FORMAT(3F10.0)
	TYPE 131
131	FORMAT(' ENTER VISIBILTY PARAMETER "MARPLT": ',$)
	ACCEPT 140, MARPLT
140	FORMAT(I6)
	CALL BGNPLT
	CSIZE = GOODCS(0.3)
	CALL PURJOY(Z,NX,IZ,NX,NY,CAMLOC,XYLIM,'X AXIS',
	1   'Y AXIS','Z AXIS',CSIZE,MARPLT)
	CALL ENDPLT
	CALL RLSDEV
	STOP
	END
	FUNCTION FXY(X,Y,XC,YC,XS,YS)
	R = (X-XC)**2/XS + (Y-YC)**2/YS
	FXY = COS(R)*EXP(-R)
	RETURN
	END
