1 /* sphcyl.f -- translated by f2c (version 19980913).
2    You must link the resulting object file with the libraries:
3 	-lf2c -lm   (in that order)
4 */
5 
6 #include "f2c.h"
7 
8 /* $Procedure      SPHCYL ( Spherical to cylindrical coordinates ) */
sphcyl_(doublereal * radius,doublereal * colat,doublereal * slong,doublereal * r__,doublereal * long__,doublereal * z__)9 /* Subroutine */ int sphcyl_(doublereal *radius, doublereal *colat,
10 	doublereal *slong, doublereal *r__, doublereal *long__, doublereal *
11 	z__)
12 {
13     /* Builtin functions */
14     double sin(doublereal), cos(doublereal);
15 
16     /* Local variables */
17     doublereal rr, zz;
18 
19 /* $ Abstract */
20 
21 /*     This routine converts from spherical coordinates to cylindrical */
22 /*     coordinates. */
23 
24 /* $ Disclaimer */
25 
26 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
27 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
28 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
29 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
30 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
31 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
32 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
33 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
34 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
35 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
36 
37 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
38 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
39 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
40 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
41 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
42 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
43 
44 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
45 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
46 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
47 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
48 
49 /* $ Required_Reading */
50 
51 /*     None. */
52 
53 /* $ Keywords */
54 
55 /*     CONVERSION,  COORDINATES */
56 
57 /* $ Declarations */
58 /* $ Brief_I/O */
59 
60 /*     VARIABLE  I/O  DESCRIPTION */
61 /*     --------  ---  ------------------------------------------------- */
62 /*     RADIUS     I   Distance of point from origin. */
63 /*     COLAT      I   Polar angle (co-latitude in radians) of point. */
64 /*     SLONG      I   Azimuthal angle (longitude) of point (radians). */
65 /*     R          O   Distance of point from Z axis. */
66 /*     LONG       O   angle (radians) of point from XZ plane. */
67 /*     Z          O   Height of point above XY plane. */
68 
69 /* $ Detailed_Input */
70 
71 /*     RADIUS     Distance of the point from origin. */
72 
73 /*     COLAT      Polar angle (co-latitude in radians) of the point. */
74 
75 /*     SLONG      Azimuthal angle (longitude) of the point (radians). */
76 
77 /* $ Detailed_Output */
78 
79 /*     R          Distance of the point of interest from Z axis. */
80 
81 /*     LONG       cylindrical angle (radians) of the point from the */
82 /*                XZ plane. LONG is set equal to SLONG. */
83 
84 /*     Z          Height of the point above XY plane. */
85 
86 /* $ Parameters */
87 
88 /*     None. */
89 
90 /* $ Exceptions */
91 
92 /*     Error free. */
93 
94 /* $ Files */
95 
96 /*     None. */
97 
98 /* $ Particulars */
99 
100 /*     This returns the cylindrical coordinates of a point whose */
101 /*     position is input through spherical coordinates. */
102 
103 /* $ Examples */
104 
105 /*     Other than the obvious conversion between coordinate systems */
106 /*     this routine could be used to obtain the axial projection */
107 /*     from a sphere to a cylinder about the z-axis that contains */
108 /*     the equator of the sphere.  The following code fragment */
109 /*     illustrates this idea. */
110 
111 /*           CALL SPHCYL ( RADIUS, COLAT, LONG, R, LONG, Z ) */
112 /*           R = RADIUS */
113 
114 /*     R, LONG, and Z now contain the coordinates of the projected */
115 /*     point. Such a projection is valuable because it preserves the */
116 /*     areas between regions on the sphere and their projections to the */
117 /*     cylinder. */
118 
119 /* $ Restrictions */
120 
121 /*     None. */
122 
123 /* $ Literature_References */
124 
125 /*     None. */
126 
127 /* $ Author_and_Institution */
128 
129 /*     W.L. Taber      (JPL) */
130 
131 /* $ Version */
132 
133 /* -    SPICELIB Version 1.0.2, 26-JUL-2016 (BVS) */
134 
135 /*        Minor headers edits. */
136 
137 /* -    SPICELIB Version 1.0.1, 10-MAR-1992 (WLT) */
138 
139 /*        Comment section for permuted index source lines was added */
140 /*        following the header. */
141 
142 /* -    SPICELIB Version 1.0.0, 31-JAN-1990 (WLT) */
143 
144 /* -& */
145 /* $ Index_Entries */
146 
147 /*     spherical to cylindrical coordinates */
148 
149 /* -& */
150 /* $ Revisions */
151 
152 /* -    Beta Version 1.0.1, 1-Feb-1989 (WLT) */
153 
154 /*        Example section of header upgraded. */
155 
156 /* -& */
157 
158 /*     Local Variables */
159 
160 
161 /*     Convert to cylindrical coordinates, storing the results in */
162 /*     temporary variables. */
163 
164     rr = *radius * sin(*colat);
165     zz = *radius * cos(*colat);
166 
167 /*     Move the results to the output variables. */
168 
169     *long__ = *slong;
170     *r__ = rr;
171     *z__ = zz;
172     return 0;
173 } /* sphcyl_ */
174 
175