svn-gvsig-desktop / branches / v10 / libraries / libjni-proj4 / src / pj_deriv.c @ 40603
History | View | Annotate | Download (966 Bytes)
1 |
/* dervative of (*P->fwd) projection */
|
---|---|
2 |
#ifndef lint
|
3 |
static const char SCCSID[]="@(#)pj_deriv.c 4.4 93/06/12 GIE REL"; |
4 |
#endif
|
5 |
#define PJ_LIB__
|
6 |
#include "projects.h" |
7 |
int
|
8 |
pj_deriv(LP lp, double h, PJ *P, struct DERIVS *der) { |
9 |
XY t; |
10 |
|
11 |
lp.lam += h; |
12 |
lp.phi += h; |
13 |
if (fabs(lp.phi) > HALFPI) return 1; |
14 |
h += h; |
15 |
t = (*P->fwd)(lp, P); |
16 |
if (t.x == HUGE_VAL) return 1; |
17 |
der->x_l = t.x; der->y_p = t.y; der->x_p = -t.x; der->y_l = -t.y; |
18 |
lp.phi -= h; |
19 |
if (fabs(lp.phi) > HALFPI) return 1; |
20 |
t = (*P->fwd)(lp, P); |
21 |
if (t.x == HUGE_VAL) return 1; |
22 |
der->x_l += t.x; der->y_p -= t.y; der->x_p += t.x; der->y_l -= t.y; |
23 |
lp.lam -= h; |
24 |
t = (*P->fwd)(lp, P); |
25 |
if (t.x == HUGE_VAL) return 1; |
26 |
der->x_l -= t.x; der->y_p -= t.y; der->x_p += t.x; der->y_l += t.y; |
27 |
lp.phi += h; |
28 |
t = (*P->fwd)(lp, P); |
29 |
if (t.x == HUGE_VAL) return 1; |
30 |
der->x_l -= t.x; der->y_p += t.y; der->x_p -= t.x; der->y_l += t.y; |
31 |
der->x_l /= (h += h); |
32 |
der->y_p /= h; |
33 |
der->x_p /= h; |
34 |
der->y_l /= h; |
35 |
return 0; |
36 |
} |