gl-draw 0.17.0-beta.37 → 0.17.0-beta.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var U=Math.pow;const o=require("three"),R=t=>t instanceof o.Vector3?t:new o.Vector3(...t),w=t=>t instanceof o.Vector2?t:new o.Vector2(...t),e={a:6378137,b:6356752314245179e-9,f:1/298.257223563};function x(t,p,u=0,n=1/e.a,h=!1){const s=o.MathUtils.degToRad(t),r=o.MathUtils.degToRad(p),c=Math.cos(r),i=Math.sin(r),d=Math.cos(s),T=Math.sin(s);let q,M,l;if(h){const a=(e.a+u)*n;q=a*c*T,M=a*i,l=a*c*d}else{const g=e.a,a=e.b,V=g*g,S=a*a,b=(V-S)/V,f=g/Math.sqrt(1-b*i*i);q=(f+u)*c*T*n,M=(f*(1-b)+u)*i*n,l=(f+u)*c*d*n}return new o.Vector3(q,M,l)}function y(t,p=1/e.a,u=!1){const n=t.x/p,h=t.y/p,s=t.z/p;if(u){const f=Math.sqrt(n*n+h*h+s*s),L=Math.atan2(n,s),C=Math.asin(h/f),D=f-e.a;return{longitude:o.MathUtils.radToDeg(L),latitude:o.MathUtils.radToDeg(C),height:D}}const r=e.a,c=e.b,i=r*r,d=c*c,T=(i-d)/i,q=(i-d)/d,M=Math.sqrt(n*n+s*s),l=Math.atan2(h*r,M*c),g=Math.atan2(n,s),a=Math.atan2(h+q*c*U(Math.sin(l),3),M-T*r*U(Math.cos(l),3)),V=Math.sin(a),S=r/Math.sqrt(1-T*V*V),b=M/Math.cos(a)-S;return{longitude:o.MathUtils.radToDeg(g),latitude:o.MathUtils.radToDeg(a),height:b}}exports.WGS84=e;exports.cartesianToCartographic=y;exports.cartographicToCartesian=x;exports.parseVector2=w;exports.parseVector3=R;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
import { Vector3 as
|
|
3
|
-
const
|
|
1
|
+
var x = Math.pow;
|
|
2
|
+
import { Vector3 as D, Vector2 as R, MathUtils as l } from "three";
|
|
3
|
+
const C = (t) => t instanceof D ? t : new D(...t), N = (t) => t instanceof R ? t : new R(...t), r = {
|
|
4
4
|
a: 6378137,
|
|
5
5
|
// 赤道半径
|
|
6
6
|
b: 6356752314245179e-9,
|
|
@@ -8,42 +8,42 @@ const X = (t) => t instanceof V ? t : new V(...t), Y = (t) => t instanceof w ? t
|
|
|
8
8
|
f: 1 / 298.257223563
|
|
9
9
|
// 扁率
|
|
10
10
|
};
|
|
11
|
-
function
|
|
12
|
-
const
|
|
13
|
-
let q,
|
|
14
|
-
if (
|
|
15
|
-
const
|
|
16
|
-
q =
|
|
11
|
+
function W(t, p, d = 0, n = 1 / r.a, i = !1) {
|
|
12
|
+
const a = l.degToRad(t), c = l.degToRad(p), s = Math.cos(c), e = Math.sin(c), M = Math.cos(a), b = Math.sin(a);
|
|
13
|
+
let q, h, u;
|
|
14
|
+
if (i) {
|
|
15
|
+
const o = (r.a + d) * n;
|
|
16
|
+
q = o * s * b, h = o * e, u = o * s * M;
|
|
17
17
|
} else {
|
|
18
|
-
const
|
|
19
|
-
q =
|
|
18
|
+
const f = r.a, o = r.b, T = f * f, S = o * o, L = (T - S) / T, g = f / Math.sqrt(1 - L * e * e);
|
|
19
|
+
q = (g + d) * s * b * n, h = (g * (1 - L) + d) * e * n, u = (g + d) * s * M * n;
|
|
20
20
|
}
|
|
21
|
-
return new
|
|
21
|
+
return new D(q, h, u);
|
|
22
22
|
}
|
|
23
|
-
function G(t,
|
|
24
|
-
const
|
|
23
|
+
function G(t, p = 1 / r.a, d = !1) {
|
|
24
|
+
const n = t.x / p, i = t.y / p, a = t.z / p;
|
|
25
25
|
if (d) {
|
|
26
|
-
const
|
|
26
|
+
const g = Math.sqrt(n * n + i * i + a * a), V = Math.atan2(n, a), w = Math.asin(i / g), y = g - r.a;
|
|
27
27
|
return {
|
|
28
|
-
longitude:
|
|
29
|
-
latitude:
|
|
30
|
-
height:
|
|
28
|
+
longitude: l.radToDeg(V),
|
|
29
|
+
latitude: l.radToDeg(w),
|
|
30
|
+
height: y
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
),
|
|
33
|
+
const c = r.a, s = r.b, e = c * c, M = s * s, b = (e - M) / e, q = (e - M) / M, h = Math.sqrt(n * n + a * a), u = Math.atan2(i * c, h * s), f = Math.atan2(n, a), o = Math.atan2(
|
|
34
|
+
i + q * s * x(Math.sin(u), 3),
|
|
35
|
+
h - b * c * x(Math.cos(u), 3)
|
|
36
|
+
), T = Math.sin(o), S = c / Math.sqrt(1 - b * T * T), L = h / Math.cos(o) - S;
|
|
37
37
|
return {
|
|
38
|
-
longitude:
|
|
39
|
-
latitude:
|
|
40
|
-
height:
|
|
38
|
+
longitude: l.radToDeg(f),
|
|
39
|
+
latitude: l.radToDeg(o),
|
|
40
|
+
height: L
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
r as W,
|
|
45
|
+
N as a,
|
|
46
46
|
G as b,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
W as c,
|
|
48
|
+
C as p
|
|
49
49
|
};
|