Skip to content

Commit 36bf41d

Browse files
substacksubstack
authored andcommitted
add z0 to all projections
1 parent ed2224c commit 36bf41d

9 files changed

Lines changed: 25 additions & 21 deletions

File tree

‎aea/forward.glsl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ vec3 aea_forward (aea_t t, vec3 p) {
1313
return vec3(
1414
rh1 * sin(theta) + t.x0,
1515
t.rh - rh1 * cos(theta) + t.y0,
16-
p.z
16+
p.z + t.z0
1717
);
1818
}
1919
vec3 aea_forward (aea_t t, vec2 p) {

‎aea/t.glsl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
struct aea_t {
22
float lon0, lat0, lat1, lat2;
3-
float x0, y0, e3;
3+
float x0, y0, z0, e3;
44
float ns0, rh, a, c;
55
float sphere;
66
};

‎gnom/forward.glsl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ vec3 gnom_forward (gnom_t t, vec3 p) {
1616
return vec3(
1717
t.x0+t.a*ksp*cosphi*sin(dlon)/g,
1818
t.y0+t.a*ksp*(t.cos_p14*sinphi-t.sin_p14*cosphi*coslon)/g,
19-
p.z
19+
t.z0+p.z
2020
);
2121
} else {
2222
return vec3(
2323
t.x0+t.infinity_dist*cosphi*sin(dlon),
2424
t.y0+t.infinity_dist*(t.cos_p14*sinphi-t.sin_p14*cosphi*coslon),
25-
p.z
25+
t.z0+p.z
2626
);
2727
}
2828
}

‎gnom/t.glsl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
struct gnom_t {
2-
float lon0, lat0, x0, y0;
2+
float lon0, lat0, x0, y0, z0;
33
float sin_p14, cos_p14;
44
float a, k0;
55
float infinity_dist, rc;

‎index.js‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ module.exports = function (str) {
2020
members = {
2121
lon0: p.long0,
2222
lat0: p.lat0,
23-
x0: p.x0,
24-
y0: p.y0,
23+
x0: defined(p.x0,0),
24+
y0: defined(p.y0,0),
25+
z0: defined(p.z0,0),
2526
a: defined(p.a,e.a),
2627
k0: defined(p.k0,1.0),
2728
sin_p14: Math.sin(p.lat0),
@@ -35,8 +36,9 @@ module.exports = function (str) {
3536
lat0: p.lat0,
3637
lat1: p.lat1,
3738
lat2: p.lat2,
38-
x0: p.x0,
39-
y0: p.y0,
39+
x0: defined(p.x0,0),
40+
y0: defined(p.y0,0),
41+
z0: defined(p.z0,0),
4042
a: defined(p.a,e.a),
4143
sphere: p.sphere ? 1.0 : 0.0
4244
}
@@ -70,8 +72,9 @@ module.exports = function (str) {
7072
members = {
7173
lon0: p.long0,
7274
lat0: p.lat0,
73-
x0: p.x0,
74-
y0: p.y0,
75+
x0: defined(p.x0,0),
76+
y0: defined(p.y0,0),
77+
z0: defined(p.z0,0),
7578
a: defined(p.a,e.a),
7679
k0: defined(p.k0,1.0),
7780
sphere: p.sphere ? 1.0 : 0.0,
@@ -104,6 +107,7 @@ module.exports = function (str) {
104107
lat2: defined(p.lat2, p.lat1),
105108
x0: defined(p.x0, 0),
106109
y0: defined(p.y0, 0),
110+
z0: defined(p.z0,0),
107111
k0: defined(p.k0, 1),
108112
a: a,
109113
b: b,

‎lcc/forward.glsl‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ vec3 lcc_forward (lcc_t t, vec3 p) {
1818
}
1919
float theta = t.ns * (lon - t.lon0);
2020
return vec3(
21-
t.k0*rh1*sin(theta)+t.x0,
22-
t.k0*(t.rh-rh1*cos(theta))+t.y0,
23-
p.z
21+
t.x0+t.k0*rh1*sin(theta),
22+
t.y0+t.k0*(t.rh-rh1*cos(theta)),
23+
t.z0+p.z
2424
);
2525
}
2626
vec3 lcc_forward (lcc_t t, vec2 p) {

‎lcc/t.glsl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
struct lcc_t {
22
float lon0, lat0, lat1, lat2;
3-
float x0, y0;
3+
float x0, y0, z0;
44
float a, b, e;
55
float k0, ns, f0, rh;
66
};

‎tmerc/forward.glsl‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ vec3 tmerc_forward (tmerc_t t, vec3 p) {
2727
float n = t.a/sqrt(con);
2828
float ml = t.a*mlfn(t.e0,t.e1,t.e2,t.e3,lat);
2929
return vec3(
30-
t.k0*n*al*(1.0+als/6.0*(1.0-tq2+c+als/20.0
31-
*(5.0-18.0*tq2+tq2*tq2+72.0*c-58.0*t.ep2)))+t.x0,
32-
t.k0*(ml-t.ml0+n*tq*(als*(0.5+als/24.0*(5.0-tq2+9.0*c+4.0*c*c+als/30.0
33-
*(61.0-58.0*tq2+tq2*tq2+600.0*c-330.0*t.ep2)))))+t.y0,
34-
p.z
30+
t.x0+t.k0*n*al*(1.0+als/6.0*(1.0-tq2+c+als/20.0
31+
*(5.0-18.0*tq2+tq2*tq2+72.0*c-58.0*t.ep2))),
32+
t.y0+t.k0*(ml-t.ml0+n*tq*(als*(0.5+als/24.0*(5.0-tq2+9.0*c+4.0*c*c+als/30.0
33+
*(61.0-58.0*tq2+tq2*tq2+600.0*c-330.0*t.ep2))))),
34+
t.z0+p.z
3535
);
3636
}
3737
vec3 tmerc_forward (tmerc_t t, vec2 p) {

‎tmerc/t.glsl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
struct tmerc_t {
2-
float lon0, lat0, x0, y0;
2+
float lon0, lat0, x0, y0, z0;
33
float a, sphere, k0;
44
float e0, e1, e2, e3, ml0, ep2, es;
55
};

0 commit comments

Comments
 (0)