This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / GEANT321 / gdraw / gdsarc.F
1 *
2 * $Id$
3 *
4 * $Log$
5 * Revision 1.1.1.1  1995/10/24 10:20:27  cernlib
6 * Geant
7 *
8 *
9 #include "geant321/pilot.h"
10 *CMZ :  3.21/02 29/03/94  15.41.27  by  S.Giani
11 *-- Author :
12       SUBROUTINE GDSARC(R,PHI1,PHI2,X,NP)
13 C.
14 C.    ******************************************************************
15 C.    *                                                                *
16 C.    *       Computes and store in X(1..2,1..NP) arc points           *
17 C.    *       (only X and Y coordinates) for GDRWSC                    *
18 C.    *       of the circle of radius R centered on Z-axis,            *
19 C.    *       from PHI1 to PHI2,                                       *
20 C.    *       on a plane parallel to X-Y plane                         *
21 C.    *                                                                *
22 C.    *    ==>Called by : GDRWSC                                       *
23 C.    *       Author : P.Zanarini   *********                          *
24 C.    *                                                                *
25 C.    ******************************************************************
26 C.
27 #include "geant321/gconsp.inc"
28 #include "geant321/gcdraw.inc"
29 #include "geant321/gcunit.inc"
30       DIMENSION X(2,42)
31       SAVE MAXNP
32       DATA MAXNP/42/
33 C.
34 C.    ------------------------------------------------------------------
35 C.
36       PHIMIN=PHI1
37       PHIMAX=PHI2
38 C
39       NP=1
40       PH=PHIMIN*DEGRAD
41       X(1,1)=R*COS(PH)
42       X(2,1)=R*SIN(PH)
43 C
44       IF(ABS(PHIMAX-PHIMIN).LE.9.) GO TO 20
45 C
46       I1=PHIMIN/9.0+2
47       I2=PHIMAX/9.0+1
48       NAS=I2-I1+1
49       IF(NAS.LE.0) NAS=NAS+40
50       IC=I1
51 C
52       IF (NAS.GT.MAXNP-2) GO TO 30
53 C
54       DO 10 IAS=1,NAS
55          IF(IC.GT.40) IC=IC-40
56          NP=NP+1
57          ICC=IC
58          IF (ICC.LE.0) ICC=40+ICC
59          X(1,NP)=R*GCOS(ICC)
60          X(2,NP)=R*GSIN(ICC)
61          IC=IC+1
62    10 CONTINUE
63 C
64    20 CONTINUE
65 C
66       PH=PHIMAX*DEGRAD
67       NP=NP+1
68       X(1,NP)=R*COS(PH)
69       X(2,NP)=R*SIN(PH)
70       GO TO 999
71 C
72    30 CONTINUE
73       NP=NAS+2
74       WRITE (CHMAIL,1000) NP
75       CALL GMAIL(0,0)
76 C
77  1000 FORMAT (' GDSARC: INTERNAL ERROR !!!   -   NP =',I5)
78   999 RETURN
79       END