## 12.21 Examples

                PROGRAM EXA12_2
                CHARACTER*60 CTIT1,CTIT2
                EXTERNAL ZFUN

                CTIT1='Surface Plot of the Parametric Function'
                CTIT2='[COS(t)*(3+COS(u)),
               *              SIN(t)*(3+COS(u)), SIN(u)]'
                PI=3.14159

                CALL SETPAG('DA4P')
                CALL METAFL('POST')
                CALL DISINI
                CALL HWFONT
                CALL PAGERA
                CALL AXSPOS(200,2400)
                CALL AXSLEN(1800,1800)
                CALL INTAX

                CALL TITLIN(CTIT1,2)
                CALL TITLIN(CTIT2,4)

                CALL NAME('X-axis','X')
                CALL NAME('Y-axis','Y')
                CALL NAME('Z-axis','Z')

                CALL VKYTIT(-300)
                CALL GRAF3D(-4.,4.,-4.,1.,-4.,4.,-4.,1.,
               *                          -3.,3.,-3.,1.)

                CALL HEIGHT(40)
                CALL TITLE

                CALL SURMSH('ON')
                STEP=2*PI/30.
                CALL SURFCP(ZFUN,0.,2*PI,STEP,0.,2*PI,STEP)
                CALL DISFIN
                END

                FUNCTION ZFUN(X,Y,IOPT)

                IF(IOPT.EQ.1) THEN
                  ZFUN=COS(X)*(3+COS(Y))
                ELSE IF(IOPT.EQ.2) THEN
                  ZFUN=SIN(X)*(3+COS(Y))
                ELSE
                  ZFUN=SIN(Y)
                END IF
                END

Figure 12.2: Surface Plot of a Parametric Function