Menu

[r4420]: / trunk / toolkits / basemap / src / pj_deriv.c  Maximize  Restore  History

Download this file

37 lines (35 with data), 966 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* dervative of (*P->fwd) projection */
#ifndef lint
static const char SCCSID[]="@(#)pj_deriv.c 4.4 93/06/12 GIE REL";
#endif
#define PJ_LIB__
#include "projects.h"
int
pj_deriv(LP lp, double h, PJ *P, struct DERIVS *der) {
XY t;
lp.lam += h;
lp.phi += h;
if (fabs(lp.phi) > HALFPI) return 1;
h += h;
t = (*P->fwd)(lp, P);
if (t.x == HUGE_VAL) return 1;
der->x_l = t.x; der->y_p = t.y; der->x_p = -t.x; der->y_l = -t.y;
lp.phi -= h;
if (fabs(lp.phi) > HALFPI) return 1;
t = (*P->fwd)(lp, P);
if (t.x == HUGE_VAL) return 1;
der->x_l += t.x; der->y_p -= t.y; der->x_p += t.x; der->y_l -= t.y;
lp.lam -= h;
t = (*P->fwd)(lp, P);
if (t.x == HUGE_VAL) return 1;
der->x_l -= t.x; der->y_p -= t.y; der->x_p += t.x; der->y_l += t.y;
lp.phi += h;
t = (*P->fwd)(lp, P);
if (t.x == HUGE_VAL) return 1;
der->x_l -= t.x; der->y_p += t.y; der->x_p -= t.x; der->y_l += t.y;
der->x_l /= (h += h);
der->y_p /= h;
der->x_p /= h;
der->y_l /= h;
return 0;
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.