          SUBROUTINE ROPIYA(RO,PI,YA,CX,CY,CZ)
          COMMON/POINTS/INIT,PT(6,31)
          COMMON/BULK/I3STRT,I3END,O(6,31)
          DATA RD/.01714511/
          IF(INIT.EQ.0)GO TO 5
          ROT11=1.
          ROT12=0.
          ROT13=0.
          ROT21=0.
          ROT22=1.
          ROT23=0.
          ROT31=0.
          ROT32=0.
          ROT33=1.
          INIT=0
5         IF(RO.NE.0.)GO TO 1
          IF(PI.NE.0.)GO TO 2
          IF(YA.NE.0.)GO TO 3
          GO TO 99
1         AM11=1.
          AM12=0.
          AM13=0.
          AM21=0.
          AM22=COS(RO*RD)
          AM32=SIN(RO*RD)
          AM31=0.
          AM23=-AM32
          AM33=AM22
          GO TO 10
2         AM11=COS(PI*RD)
          AM12=0.
          AM13=SIN(PI*RD)
          AM21=0.
          AM22=1.
          AM23=0.
          AM31=-AM13
          AM32=0.
          AM33=AM11
          GO TO 10
3         AM11=COS(YA*RD)
          AM21=SIN(YA*RD)
          AM13=0.
          AM12=-AM21
          AM22=AM11
          AM23=0.
          AM31=0.
          AM32=0.
          AM33=1.
10        SAVE1=ROT11
          SAVE2=ROT12
          ROT11=ROT11*AM11+ROT12*AM21+ROT13*AM31
          ROT12=SAVE1*AM12+ROT12*AM22+ROT13*AM32
          ROT13=SAVE1*AM13+SAVE2*AM23+ROT13*AM33
          SAVE1=ROT21
          SAVE2=ROT22
          ROT21=ROT21*AM11+ROT22*AM21+ROT23*AM31
          ROT22=SAVE1*AM12+ROT22*AM22+ROT23*AM32
          ROT23=SAVE1*AM13+SAVE2*AM23+ROT23*AM33
          SAVE1=ROT31
          SAVE2=ROT32
          ROT31=ROT31*AM11+ROT32*AM21+ROT33*AM31
          ROT32=SAVE1*AM12+ROT32*AM22+ROT33*AM32
          ROT33=SAVE1*AM13+SAVE2*AM23+ROT33*AM33
          DO 69 I=I3STRT,I3END
          DO 69 J=1,2
          KK=0
          IF(J.EQ.2)KK=3
          KK1=KK+1
          KK2=KK+2
          KK3=KK+3
          X1=PT(KK1,I)-CX
          Y1=PT(KK2,I)-CY
          Z1=PT(KK3,I)-CZ
          O(KK1,I)=ROT11*X1+ROT12*Y1+ROT13*Z1+CX
          O(KK2,I)=ROT21*X1+ROT22*Y1+ROT23*Z1+CY
69        O(KK3,I)=ROT31*X1+ROT32*Y1+ROT33*Z1+CZ
99        RETURN
          END
