1 /* zzelnaxx.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 ZZELNAXX ( ellipse normal axis intercepts ) */
zzelnaxx_(doublereal * a,doublereal * b,doublereal * lat,doublereal * xxpt,doublereal * yxpt)9 /* Subroutine */ int zzelnaxx_(doublereal *a, doublereal *b, doublereal *lat,
10 doublereal *xxpt, doublereal *yxpt)
11 {
12 /* System generated locals */
13 doublereal d__1;
14
15 /* Builtin functions */
16 double cos(doublereal), sin(doublereal);
17
18 /* Local variables */
19 extern /* Subroutine */ int chkin_(char *, ftnlen), errdp_(char *,
20 doublereal *, ftnlen), ednmpt_(doublereal *, doublereal *,
21 doublereal *, doublereal *, doublereal *);
22 doublereal normal[3];
23 extern /* Subroutine */ int sigerr_(char *, ftnlen), chkout_(char *,
24 ftnlen), setmsg_(char *, ftnlen);
25 extern logical return_(void);
26 doublereal ept[3];
27
28 /* $ Abstract */
29
30 /* SPICE Private routine intended solely for the support of SPICE */
31 /* routines. Users should not call this routine directly due */
32 /* to the volatile nature of this routine. */
33
34 /* Given semi-axis lengths of an ellipse and a planetodetic */
35 /* latitude, find the X-axis and Y-axis intercepts of the normal */
36 /* line corresponding to the point at that latitude in the right */
37 /* (positive X) half-plane. */
38
39 /* $ Disclaimer */
40
41 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
42 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
43 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
44 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
45 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
46 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
47 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
48 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
49 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
50 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
51
52 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
53 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
54 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
55 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
56 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
57 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
58
59 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
60 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
61 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
62 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
63
64 /* $ Required_Reading */
65
66 /* None. */
67
68 /* $ Keywords */
69
70 /* DSK */
71 /* ELLIPSE */
72 /* GEOMETRY */
73
74 /* $ Declarations */
75 /* $ Brief_I/O */
76
77 /* Variable I/O Description */
78 /* -------- --- -------------------------------------------------- */
79 /* A I Ellipse's semi-axis length in the X direction. */
80 /* B I Ellipse's semi-axis length in the Y direction. */
81 /* LAT I Planetodetic latitude in radians. */
82 /* XXPT O Normal line intercept on the X-axis. */
83 /* YXPT O Normal line intercept on the Y-axis. */
84
85 /* $ Detailed_Input */
86
87 /* A, */
88 /* B are, respectively, an ellipse's semi-axis lengths */
89 /* in the X and Y directions. The ellipse lies in */
90 /* two-dimensional Euclidean space. */
91
92 /* Any of the relationships */
93
94 /* A < B, A = B, A > B */
95
96 /* are allowed. */
97
98
99 /* LAT is a planetodetic latitude corresponding to */
100 /* some point P on the ellipse defined by A and B, */
101 /* where */
102
103 /* P(1) >= 0 */
104
105 /* Units are radians. */
106
107 /* $ Detailed_Output */
108
109 /* XXPT is the X-intercept of a line passing through the */
110 /* ellipse and normal to the ellipse at the point having */
111 /* the given latitude. */
112
113 /* If LAT = 0 radians, XXPT is defined to be */
114
115 /* 2 */
116 /* A - B / A */
117
118
119 /* YXPT is the Y-intercept of a line passing through the */
120 /* ellipse and normal to the ellipse at the point having */
121 /* the given latitude. */
122
123 /* If LAT = pi/2 radians, YXPT is defined to be */
124
125 /* 2 */
126 /* B - A / B */
127
128 /* If LAT = -pi/2 radians, YXPT is defined to be */
129
130 /* 2 */
131 /* -B + A / B */
132
133 /* $ Parameters */
134
135 /* None. */
136
137 /* $ Exceptions */
138
139 /* 1) If the X semi-axis length A is non-positive, the */
140 /* error SPICE(NONPOSITIVEAXIS) will be signaled. */
141
142 /* 2) If the Y semi-axis length B is non-positive, the */
143 /* error SPICE(NONPOSITIVEAXIS) will be signaled. */
144
145 /* $ Files */
146
147 /* None. */
148
149 /* $ Particulars */
150
151
152 /* The outputs of this routine can be used to determine the */
153 /* apex of a cone of constant planetodetic latitude. */
154
155
156 /* The axis intercepts computed by this routine are defined */
157 /* as described below. */
158
159 /* Let M be the normal vector's slope. Let DELTAX be */
160 /* X - XXPT. Then, given that the normal direction is */
161 /* parallel to */
162
163 /* 2 2 */
164 /* ( X/A, Y/B ) */
165
166 /* we have, for non-zero DELTAX, */
167
168 /* Y = M * DELTAX */
169
170 /* 2 2 */
171 /* = ( A / B ) * ( Y / X ) * ( X - XXPT ) */
172
173 /* So */
174 /* 2 2 */
175 /* X ( B / A ) = X - XXPT */
176
177 /* and */
178 /* 2 2 */
179 /* XXPT = X ( 1 - (B / A ) ) */
180
181
182 /* The X intercept is a linear function of the X-coordinate */
183 /* of the point on the ellipsoid. Define the intercept for */
184
185 /* X = 0 */
186
187 /* as the limit as X -> 0 of the expression for XXPT above. */
188 /* The expression is continuous and defined at X = 0, so */
189 /* we can just evaluate the expression at X = 0 as for other */
190 /* values of X. */
191
192
193 /* Using the definition of M above, we have for non-zero X: */
194
195 /* Y - YXPT = M * X */
196
197 /* or */
198
199 /* YXPT = Y - M*X */
200
201 /* 2 2 */
202 /* = Y - ( A / B ) (Y/X) * X */
203
204 /* 2 2 */
205 /* = Y ( 1 - ( A / B ) ) */
206
207 /* As above, we define YXPT at X = 0 to be the limit as X -> 0 */
208 /* of the expression above, which is */
209
210 /* 2 2 */
211 /* B ( 1 - ( A / B ) ) */
212
213
214 /* $ Examples */
215
216 /* See usage in ZZRYXPDT. */
217
218 /* $ Restrictions */
219
220 /* None. */
221
222 /* $ Literature_References */
223
224 /* None. */
225
226 /* $ Author_and_Institution */
227
228 /* N.J. Bachman (JPL) */
229
230 /* $ Version */
231
232 /* - SPICELIB Version 1.0.0, 09-MAR-2016 (NJB) */
233
234 /* -& */
235 /* $ Index_Entries */
236
237 /* find x and y intercepts of ellipse normal line */
238
239 /* -& */
240
241 /* SPICELIB functions */
242
243
244 /* Local variables */
245
246 if (return_()) {
247 return 0;
248 }
249 if (*a <= 0. || *b <= 0.) {
250 chkin_("ZZELNAXX", (ftnlen)8);
251 setmsg_("Semi-axis lengths were A = #; B = #. Both must be positive.",
252 (ftnlen)59);
253 errdp_("#", a, (ftnlen)1);
254 errdp_("#", b, (ftnlen)1);
255 sigerr_("SPICE(NONPOSITIVEAXIS)", (ftnlen)22);
256 chkout_("ZZELNAXX", (ftnlen)8);
257 return 0;
258 }
259
260 /* Find the point lying on the positive X portion of the ellipsoid */
261 /* and having the input planetodetic latitude. */
262
263 /* To start, create a normal vector pointing in the direction */
264 /* indicated by the latitude. We'll work in three dimensions in */
265 /* order to take advantage of existing code. The third coordinates */
266 /* of all participating vectors will be zero. */
267
268 normal[0] = cos(*lat);
269 normal[1] = sin(*lat);
270 normal[2] = 0.;
271 ednmpt_(a, b, b, normal, ept);
272
273 /* Compute the X-axis and Y-axis intercepts of the line */
274 /* passing through EPT and parallel to a normal vector */
275 /* at EPT. Refer to the Particulars above for details. */
276
277 /* Computing 2nd power */
278 d__1 = *b / *a;
279 *xxpt = (1. - d__1 * d__1) * ept[0];
280 /* Computing 2nd power */
281 d__1 = *a / *b;
282 *yxpt = (1. - d__1 * d__1) * ept[1];
283 return 0;
284 } /* zzelnaxx_ */
285
286