1 /* zzdsksgx.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 ZZDSKSGX ( DSK, ray-segment intercept ) */
zzdsksgx_(integer * handle,integer * dladsc,integer * dtype,doublereal * et,doublereal * vertex,doublereal * raydir,doublereal * xpt,doublereal * dc,integer * ic,logical * found)9 /* Subroutine */ int zzdsksgx_(integer *handle, integer *dladsc, integer *
10 dtype, doublereal *et, doublereal *vertex, doublereal *raydir,
11 doublereal *xpt, doublereal *dc, integer *ic, logical *found)
12 {
13 integer plid;
14 extern /* Subroutine */ int chkin_(char *, ftnlen), dskx02_(integer *,
15 integer *, doublereal *, doublereal *, integer *, doublereal *,
16 logical *);
17 extern doublereal touchd_(doublereal *);
18 extern /* Subroutine */ int sigerr_(char *, ftnlen);
19 doublereal retval;
20 extern /* Subroutine */ int chkout_(char *, ftnlen), setmsg_(char *,
21 ftnlen), errint_(char *, integer *, ftnlen);
22 extern logical return_(void);
23
24 /* $ Abstract */
25
26 /* SPICE Private routine intended solely for the support of SPICE */
27 /* routines. Users should not call this routine directly due to the */
28 /* volatile nature of this routine. */
29
30 /* Find the intersection of a ray and the surface described by */
31 /* a single DSK segment. */
32
33 /* $ Disclaimer */
34
35 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
36 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
37 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
38 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
39 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
40 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
41 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
42 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
43 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
44 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
45
46 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
47 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
48 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
49 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
50 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
51 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
52
53 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
54 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
55 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
56 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
57
58 /* $ Required_Reading */
59
60 /* DSK */
61
62 /* $ Keywords */
63
64 /* GEOMETRY */
65 /* INTERCEPT */
66 /* INTERSECTION */
67 /* RAY */
68 /* SURFACE */
69 /* TOPOGRAPHY */
70
71 /* $ Declarations */
72 /* $ Brief_I/O */
73
74 /* VARIABLE I/O DESCRIPTION */
75 /* -------- --- -------------------------------------------------- */
76 /* HANDLE I DSK file handle. */
77 /* DLADSC I DLA descriptor of segment. */
78 /* DTYPE I Data type code. */
79 /* ET I Epoch, expressed as seconds past J2000 TDB. */
80 /* VERTEX I Ray's vertex. */
81 /* RAYDIR I Ray's direction vector. */
82 /* XPT O Surface intercept, if found. */
83 /* DC O D.p. component of source info. */
84 /* IC O Integer component of source info. */
85 /* FOUND O Found flag. */
86
87 /* $ Detailed_Input */
88
89 /* HANDLE is the handle of a DSK file containing a segment */
90 /* to be used in a ray-surface intercept computation. */
91
92 /* DLASDC is the DLA descriptor of the DSK segment to be used. */
93
94 /* DTYPE is the data type code of the segment. While this */
95 /* information can be retrieved from the DSK descriptor */
96 /* of the segment, the availability of this argument */
97 /* saves the time needed to do so. */
98
99 /* ET is the epoch of the intersection computation, */
100 /* expressed as seconds past J2000 TDB. This epoch is */
101 /* used for DSK segment selection. */
102
103 /* VERTEX, */
104 /* RAYDIR are, respectively, the vertex and direction vector of */
105 /* the ray to be used in the intercept computation. */
106
107 /* Both the vertex and ray's direction vector must be */
108 /* represented in the reference frame of the segment. The */
109 /* vertex is considered to be an offset from the center */
110 /* of the reference frame associated with the segment. */
111
112 /* $ Detailed_Output */
113
114 /* XPT is the intercept of the ray on the surface described */
115 /* by the segment, if such an intercept exists. If the */
116 /* ray intersects the surface at multiple points, the */
117 /* one closest to the ray's vertex is selected. XPT is */
118 /* valid if and only if FOUND is .TRUE. */
119
120 /* XPT is expressed in the reference frame associated */
121 /* with the specified segment. It represents an offset */
122 /* from the center of this frame. Note that the frame */
123 /* center may differ from the central body of the */
124 /* segment. */
125
126
127 /* DC is the double precision component of the data */
128 /* source information. Contents are data type- */
129 /* dependent. DC is valid if and only if FOUND */
130 /* is .TRUE. */
131
132
133 /* IC is the integer component of the data */
134 /* source information. Contents are data type- */
135 /* dependent. IC is valid if and only if FOUND */
136 /* is .TRUE. */
137
138 /* For type 2 segments, IC contains just the */
139 /* intercept plate ID in element 1. */
140
141
142 /* FOUND is a logical flag that is set to .TRUE. if and only */
143 /* if a ray-surface intercept was found. */
144
145 /* $ Parameters */
146
147 /* None. */
148
149 /* $ Exceptions */
150
151 /* 1) If the DSK segment data type is not recognized, the error */
152 /* SPICE(TYPENOTSUPPORTED) is signaled. */
153
154 /* $ Files */
155
156 /* Appropriate kernels must be loaded by the calling program before */
157 /* this routine is called. */
158
159 /* The following data are required: */
160
161 /* - DSK data: the DSK file designated by HANDLE and containing */
162 /* the segment having the DLA descriptor DLADSC must be loaded */
163 /* at the time this routine is called. */
164
165 /* Kernel data are normally loaded once per program run, NOT every */
166 /* time this routine is called. */
167
168 /* $ Particulars */
169
170 /* This routine sits on top of data DSK type-specific ray-segment */
171 /* intercept routines such as DSKX02. */
172
173 /* $ Examples */
174
175 /* See usage in ZZDSKBUX. */
176
177 /* $ Restrictions */
178
179 /* This is a private routine. It is meant to be used only by the DSK */
180 /* subsystem. */
181
182 /* $ Literature_References */
183
184 /* None. */
185
186 /* $ Author_and_Institution */
187
188 /* N.J. Bachman (JPL) */
189
190 /* $ Version */
191
192 /* - SPICELIB Version 1.0.0, 18-FEB-2016 (NJB) */
193
194 /* Based on first version 20-JAN-2015 (NJB) */
195
196 /* -& */
197 /* $ Index_Entries */
198
199 /* find intercept of ray with surface defined by dsk segment */
200
201 /* -& */
202
203 /* SPICELIB functions */
204
205
206 /* Local variables */
207
208 if (return_()) {
209 return 0;
210 }
211 chkin_("ZZDSKSGX", (ftnlen)8);
212
213 /* Note: input argument ET is provided to support time-dependent */
214 /* data types. */
215
216 retval = touchd_(et);
217 dc[0] = touchd_(dc);
218 if (*dtype == 2) {
219
220 /* The intercept plate ID is returned in element 1 of */
221 /* IC, if an intercept is found. */
222
223 dskx02_(handle, dladsc, vertex, raydir, &plid, xpt, found);
224 if (*found) {
225 ic[0] = plid;
226 }
227 } else {
228 setmsg_("DSK ray-surface intercepts are not supported for DSK data t"
229 "ype #.", (ftnlen)65);
230 errint_("#", dtype, (ftnlen)1);
231 sigerr_("SPICE(TYPENOTSUPPORTED)", (ftnlen)23);
232 chkout_("ZZDSKSGX", (ftnlen)8);
233 return 0;
234 }
235 chkout_("ZZDSKSGX", (ftnlen)8);
236 return 0;
237 } /* zzdsksgx_ */
238
239