1 /* drdlat.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 DRDLAT ( Derivative of rectangular w.r.t. latitudinal ) */
drdlat_(doublereal * r__,doublereal * long__,doublereal * lat,doublereal * jacobi)9 /* Subroutine */ int drdlat_(doublereal *r__, doublereal *long__, doublereal *
10 lat, doublereal *jacobi)
11 {
12 /* Builtin functions */
13 double cos(doublereal), sin(doublereal);
14
15 /* $ Abstract */
16
17 /* Compute the Jacobian of the transformation from latitudinal to */
18 /* rectangular coordinates. */
19
20 /* $ Disclaimer */
21
22 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
23 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
24 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
25 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
26 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
27 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
28 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
29 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
30 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
31 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
32
33 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
34 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
35 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
36 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
37 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
38 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
39
40 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
41 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
42 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
43 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
44
45 /* $ Required_Reading */
46
47 /* None. */
48
49 /* $ Keywords */
50
51 /* COORDINATES */
52 /* DERIVATIVES */
53 /* MATRIX */
54
55 /* $ Declarations */
56 /* $ Brief_I/O */
57
58 /* Variable I/O Description */
59 /* -------- --- -------------------------------------------------- */
60 /* RADIUS I Distance of a point from the origin. */
61 /* LONG I Angle of the point from the XZ plane in radians. */
62 /* LAT I Angle of the point from the XY plane in radians. */
63 /* JACOBI O Matrix of partial derivatives. */
64
65 /* $ Detailed_Input */
66
67 /* RADIUS Distance of a point from the origin. */
68
69 /* LONG Angle of the point from the XZ plane in radians. */
70 /* The angle increases in the counterclockwise sense */
71 /* about the +Z axis. */
72
73 /* LAT Angle of the point from the XY plane in radians. */
74 /* The angle increases in the direction of the +Z axis. */
75
76 /* $ Detailed_Output */
77
78 /* JACOBI is the matrix of partial derivatives of the conversion */
79 /* between latitudinal and rectangular coordinates. It has */
80 /* the form */
81
82 /* .- -. */
83 /* | DX/DR DX/DLONG DX/DLAT | */
84 /* | | */
85 /* | DY/DR DY/DLONG DY/DLAT | */
86 /* | | */
87 /* | DZ/DR DZ/DLONG DZ/DLAT | */
88 /* `- -' */
89
90 /* evaluated at the input values of R, LONG and LAT. */
91 /* Here X, Y, and Z are given by the familiar formulae */
92
93 /* X = R * COS(LONG) * COS(LAT) */
94 /* Y = R * SIN(LONG) * COS(LAT) */
95 /* Z = R * SIN(LAT) */
96
97 /* $ Parameters */
98
99 /* None. */
100
101 /* $ Exceptions */
102
103 /* Error free. */
104
105 /* $ Files */
106
107 /* None. */
108
109 /* $ Particulars */
110
111 /* It is often convenient to describe the motion of an object */
112 /* in latitudinal coordinates. It is also convenient to manipulate */
113 /* vectors associated with the object in rectangular coordinates. */
114
115 /* The transformation of a latitudinal state into an equivalent */
116 /* rectangular state makes use of the Jacobian of the */
117 /* transformation between the two systems. */
118
119 /* Given a state in latitudinal coordinates, */
120
121 /* ( r, long, lat, dr, dlong, dlat ) */
122
123 /* the velocity in rectangular coordinates is given by the matrix */
124 /* equation */
125 /* t | t */
126 /* (dx, dy, dz) = JACOBI| * (dr, dlong, dlat) */
127 /* |(r,long,lat) */
128
129 /* This routine computes the matrix */
130
131 /* | */
132 /* JACOBI| */
133 /* |(r,long,lat) */
134
135 /* $ Examples */
136
137 /* Suppose you have a model that gives radius, longitude, and */
138 /* latitude as functions of time (r(t), long(t), lat(t)), and */
139 /* that the derivatives (dr/dt, dlong/dt, dlat/dt) are computable. */
140 /* To find the velocity of the object in rectangular coordinates, */
141 /* multiply the Jacobian of the transformation from latitudinal */
142 /* to rectangular (evaluated at r(t), long(t), lat(t)) by the */
143 /* vector of derivatives of the latitudinal coordinates. */
144
145 /* This is illustrated by the following code fragment. */
146
147 /* C */
148 /* C Load the derivatives of r, long and lat into the */
149 /* C latitudinal velocity vector LATV. */
150 /* C */
151 /* LATV(1) = DR_DT ( T ) */
152 /* LATV(2) = DLONG_DT ( T ) */
153 /* LATV(3) = DLAT_DT ( T ) */
154
155 /* C */
156 /* C Determine the Jacobian of the transformation from */
157 /* C latitudinal to rectangular coordinates, using the */
158 /* C latitudinal coordinates at time T. */
159 /* C */
160 /* CALL DRDLAT ( R(T), LONG(T), LAT(T), JACOBI ) */
161
162 /* C */
163 /* C Multiply the Jacobian by the latitudinal velocity to */
164 /* C obtain the rectangular velocity RECV. */
165 /* C */
166 /* CALL MXV ( JACOBI, LATV, RECV ) */
167
168 /* $ Restrictions */
169
170 /* None. */
171
172 /* $ Literature_References */
173
174 /* None. */
175
176 /* $ Author_and_Institution */
177
178 /* W.L. Taber (JPL) */
179
180 /* $ Version */
181
182 /* - SPICELIB Version 1.0.0, 19-JUL-2001 (WLT) */
183
184 /* -& */
185 /* $ Index_Entries */
186
187 /* Jacobian of rectangular w.r.t. latitudinal coordinates */
188
189 /* -& */
190 /* $ Revisions */
191
192 /* None. */
193
194 /* -& */
195
196 /* Local variables */
197
198
199 /* Construct the matrix directly. */
200
201 jacobi[0] = cos(*long__) * cos(*lat);
202 jacobi[1] = sin(*long__) * cos(*lat);
203 jacobi[2] = sin(*lat);
204 jacobi[3] = -(*r__) * sin(*long__) * cos(*lat);
205 jacobi[4] = *r__ * cos(*long__) * cos(*lat);
206 jacobi[5] = 0.;
207 jacobi[6] = -(*r__) * cos(*long__) * sin(*lat);
208 jacobi[7] = -(*r__) * sin(*long__) * sin(*lat);
209 jacobi[8] = *r__ * cos(*lat);
210 return 0;
211 } /* drdlat_ */
212
213