gl-draw 0.17.0-beta.36 → 0.17.0-beta.37
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.
- package/dist/cartographicToCartesian.js +1 -0
- package/dist/cartographicToCartesian.module.js +49 -0
- package/dist/index.module2.js +325 -320
- package/dist/index2.js +4 -4
- package/dist/objects/conicPolygon/geometry/index.d.ts +1 -2
- package/dist/objects/ellipsoid/createGeometry.d.ts +30 -0
- package/dist/objects/ellipsoid/index.d.ts +38 -0
- package/dist/objects/index.d.ts +1 -0
- package/dist/objects/index.js +1 -1
- package/dist/objects/index.module.js +662 -619
- package/dist/plugins/Worker/getAttributes/conicLine.d.ts +1 -1
- package/dist/plugins/Worker/getAttributes/conicPolygon.d.ts +2 -3
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +36 -36
- package/dist/utils/cartographicToCartesian.d.ts +30 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.module.js +15 -13
- package/package.json +1 -1
- package/dist/polar2Cartesian.js +0 -1
- package/dist/polar2Cartesian.module.js +0 -18
- package/dist/utils/polar2Cartesian.d.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var C=Math.pow;const n=require("three"),x=t=>t instanceof n.Vector3?t:new n.Vector3(...t),y=t=>t instanceof n.Vector2?t:new n.Vector2(...t),c={a:6378137,b:6356752314245179e-9,f:1/298.257223563};function z(t,T,d=0,o=1/c.a,l=!1){const i=n.MathUtils.degToRad(t),e=n.MathUtils.degToRad(T),a=Math.cos(e),r=Math.sin(e),g=Math.cos(i),q=Math.sin(i);let V,h,u;if(l){const s=(c.a+d)*o;V=s*a*g,h=s*r,u=s*a*q}else{const M=c.a,s=c.b,b=M*M,S=s*s,f=(b-S)/b,p=M/Math.sqrt(1-f*r*r),U=(p+d)*a*g*o,L=(p+d)*a*q*o,m=(p*(1-f)+d)*r*o;V=U,h=m,u=L}return new n.Vector3(V,h,u)}function G(t,T=1/c.a,d=!1){const o=t.x/T,l=t.y/T,i=t.z/T;if(d){const m=Math.sqrt(o*o+l*l+i*i),D=Math.atan2(i,o),R=Math.asin(l/m),w=m-c.a;return{longitude:n.MathUtils.radToDeg(D),latitude:n.MathUtils.radToDeg(R),height:w}}const e=c.a,a=c.b,r=e*e,g=a*a,q=(r-g)/r,V=(r-g)/g,h=o,u=i,M=l,s=Math.sqrt(h*h+u*u),b=Math.atan2(M*e,s*a),S=Math.atan2(u,h),f=Math.atan2(M+V*a*C(Math.sin(b),3),s-q*e*C(Math.cos(b),3)),p=Math.sin(f),U=e/Math.sqrt(1-q*p*p),L=s/Math.cos(f)-U;return{longitude:n.MathUtils.radToDeg(S),latitude:n.MathUtils.radToDeg(f),height:L}}exports.WGS84=c;exports.cartesianToCartographic=G;exports.cartographicToCartesian=z;exports.parseVector2=y;exports.parseVector3=x;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var R = Math.pow;
|
|
2
|
+
import { Vector3 as V, Vector2 as w, MathUtils as p } from "three";
|
|
3
|
+
const X = (t) => t instanceof V ? t : new V(...t), Y = (t) => t instanceof w ? t : new w(...t), e = {
|
|
4
|
+
a: 6378137,
|
|
5
|
+
// 赤道半径
|
|
6
|
+
b: 6356752314245179e-9,
|
|
7
|
+
// 极半径
|
|
8
|
+
f: 1 / 298.257223563
|
|
9
|
+
// 扁率
|
|
10
|
+
};
|
|
11
|
+
function Z(t, b, d = 0, s = 1 / e.a, M = !1) {
|
|
12
|
+
const i = p.degToRad(t), a = p.degToRad(b), o = Math.cos(a), c = Math.sin(a), f = Math.cos(i), m = Math.sin(i);
|
|
13
|
+
let q, r, u;
|
|
14
|
+
if (M) {
|
|
15
|
+
const n = (e.a + d) * s;
|
|
16
|
+
q = n * o * f, r = n * c, u = n * o * m;
|
|
17
|
+
} else {
|
|
18
|
+
const h = e.a, n = e.b, T = h * h, S = n * n, g = (T - S) / T, l = h / Math.sqrt(1 - g * c * c), x = (l + d) * o * f * s, D = (l + d) * o * m * s, L = (l * (1 - g) + d) * c * s;
|
|
19
|
+
q = x, r = L, u = D;
|
|
20
|
+
}
|
|
21
|
+
return new V(q, r, u);
|
|
22
|
+
}
|
|
23
|
+
function G(t, b = 1 / e.a, d = !1) {
|
|
24
|
+
const s = t.x / b, M = t.y / b, i = t.z / b;
|
|
25
|
+
if (d) {
|
|
26
|
+
const L = Math.sqrt(s * s + M * M + i * i), y = Math.atan2(i, s), z = Math.asin(M / L), C = L - e.a;
|
|
27
|
+
return {
|
|
28
|
+
longitude: p.radToDeg(y),
|
|
29
|
+
latitude: p.radToDeg(z),
|
|
30
|
+
height: C
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const a = e.a, o = e.b, c = a * a, f = o * o, m = (c - f) / c, q = (c - f) / f, r = s, u = i, h = M, n = Math.sqrt(r * r + u * u), T = Math.atan2(h * a, n * o), S = Math.atan2(u, r), g = Math.atan2(
|
|
34
|
+
h + q * o * R(Math.sin(T), 3),
|
|
35
|
+
n - m * a * R(Math.cos(T), 3)
|
|
36
|
+
), l = Math.sin(g), x = a / Math.sqrt(1 - m * l * l), D = n / Math.cos(g) - x;
|
|
37
|
+
return {
|
|
38
|
+
longitude: p.radToDeg(S),
|
|
39
|
+
latitude: p.radToDeg(g),
|
|
40
|
+
height: D
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
e as W,
|
|
45
|
+
Y as a,
|
|
46
|
+
G as b,
|
|
47
|
+
Z as c,
|
|
48
|
+
X as p
|
|
49
|
+
};
|