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.
@@ -0,0 +1,30 @@
1
+ import { Vector3 } from 'three';
2
+ /**
3
+ * 将地理坐标 (经度, 纬度, 高度) 转换为 Cartesian3 坐标
4
+ * 类似 Cesium 的 Ellipsoid.cartographicToCartesian
5
+ * @param longitude 经度(度)
6
+ * @param latitude 纬度(度)
7
+ * @param height 椭球体表面之上的高度(米),默认为 0
8
+ * @param scaleFactor 缩放因子,默认为 1/WGS84.a(将地球缩放到半径≈1)
9
+ * @param usePerfectSphere 是否使用完美球体(忽略椭球体扁率),默认 false
10
+ * @returns Vector3 笛卡尔坐标(已缩放)
11
+ */
12
+ export declare const WGS84: {
13
+ a: number;
14
+ b: number;
15
+ f: number;
16
+ };
17
+ export declare function cartographicToCartesian(longitude: number, latitude: number, height?: number, scaleFactor?: number, usePerfectSphere?: boolean): Vector3;
18
+ /**
19
+ * 将 Cartesian3 坐标转换为地理坐标 (经度, 纬度, 高度)
20
+ * 类似 Cesium 的 Ellipsoid.cartesianToCartographic
21
+ * @param cartesian Vector3 笛卡尔坐标(已缩放)
22
+ * @param scaleFactor 缩放因子,必须与 cartographicToCartesian 使用的相同
23
+ * @param usePerfectSphere 是否使用完美球体,必须与 cartographicToCartesian 使用的相同
24
+ * @returns {longitude, latitude, height} 经纬度(度)和高度(米)
25
+ */
26
+ export declare function cartesianToCartographic(cartesian: Vector3, scaleFactor?: number, usePerfectSphere?: boolean): {
27
+ longitude: number;
28
+ latitude: number;
29
+ height: number;
30
+ };
@@ -2,5 +2,5 @@ export { applyTextureColorSpace } from './applyTextureColorSpace';
2
2
  export * from './getProjection';
3
3
  export { isPlainObject } from './isPlainObject';
4
4
  export * from './parseVector';
5
- export { polar2Cartesian } from './polar2Cartesian';
5
+ export * from './cartographicToCartesian';
6
6
  export * from './uvGenerator';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../isPlainObject.js"),l=require("d3-geo"),p=require("d3-geo-projection"),o=require("../polar2Cartesian.js"),u=require("../uvGenerator.js"),g={mercator:l.geoMercator,equirectangular:l.geoEquirectangular,winkel3:p.geoWinkel3},a={},j=e=>{var c,n,i;const r=JSON.stringify(e);if(a[r])return a[r];const t=g[(c=e.projectionType)!=null?c:"mercator"]().center(e.center).scale(e.scale).translate((n=e.translate)!=null?n:[0,0]).precision((i=e.precision)!=null?i:.1);return e.rotate&&t.rotate(e.rotate),a[r]=t,t};exports.applyTextureColorSpace=s.applyTextureColorSpace;exports.isPlainObject=s.isPlainObject;exports.parseVector2=o.parseVector2;exports.parseVector3=o.parseVector3;exports.polar2Cartesian=o.polar2Cartesian;exports.claerUVGenerator=u.claerUVGenerator;exports.getUVGenerator=u.getUVGenerator;exports.getProjection=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../isPlainObject.js"),s=require("d3-geo"),p=require("d3-geo-projection"),r=require("../cartographicToCartesian.js"),g=require("../uvGenerator.js"),u={mercator:s.geoMercator,equirectangular:s.geoEquirectangular,winkel3:p.geoWinkel3},c={},j=e=>{var o,n,i;const t=JSON.stringify(e);if(c[t])return c[t];const a=u[(o=e.projectionType)!=null?o:"mercator"]().center(e.center).scale(e.scale).translate((n=e.translate)!=null?n:[0,0]).precision((i=e.precision)!=null?i:.1);return e.rotate&&a.rotate(e.rotate),c[t]=a,a};exports.applyTextureColorSpace=l.applyTextureColorSpace;exports.isPlainObject=l.isPlainObject;exports.WGS84=r.WGS84;exports.cartesianToCartographic=r.cartesianToCartographic;exports.cartographicToCartesian=r.cartographicToCartesian;exports.parseVector2=r.parseVector2;exports.parseVector3=r.parseVector3;exports.claerUVGenerator=g.claerUVGenerator;exports.getUVGenerator=g.getUVGenerator;exports.getProjection=j;
@@ -1,27 +1,29 @@
1
1
  import { a as x, i as y } from "../isPlainObject.module.js";
2
2
  import { geoMercator as i, geoEquirectangular as s } from "d3-geo";
3
3
  import { geoWinkel3 as p } from "d3-geo-projection";
4
- import { b, p as k, a as O } from "../polar2Cartesian.module.js";
5
- import { c as C, g as G } from "../uvGenerator.module.js";
4
+ import { W as V, b, c as k, a as C, p as G } from "../cartographicToCartesian.module.js";
5
+ import { c as S, g as W } from "../uvGenerator.module.js";
6
6
  const l = {
7
7
  mercator: i,
8
8
  equirectangular: s,
9
9
  winkel3: p
10
- }, a = {}, f = (e) => {
10
+ }, t = {}, f = (r) => {
11
11
  var o, c, n;
12
- const r = JSON.stringify(e);
13
- if (a[r])
14
- return a[r];
15
- const t = l[(o = e.projectionType) != null ? o : "mercator"]().center(e.center).scale(e.scale).translate((c = e.translate) != null ? c : [0, 0]).precision((n = e.precision) != null ? n : 0.1);
16
- return e.rotate && t.rotate(e.rotate), a[r] = t, t;
12
+ const e = JSON.stringify(r);
13
+ if (t[e])
14
+ return t[e];
15
+ const a = l[(o = r.projectionType) != null ? o : "mercator"]().center(r.center).scale(r.scale).translate((c = r.translate) != null ? c : [0, 0]).precision((n = r.precision) != null ? n : 0.1);
16
+ return r.rotate && a.rotate(r.rotate), t[e] = a, a;
17
17
  };
18
18
  export {
19
+ V as WGS84,
19
20
  x as applyTextureColorSpace,
20
- C as claerUVGenerator,
21
+ b as cartesianToCartographic,
22
+ k as cartographicToCartesian,
23
+ S as claerUVGenerator,
21
24
  f as getProjection,
22
- G as getUVGenerator,
25
+ W as getUVGenerator,
23
26
  y as isPlainObject,
24
- b as parseVector2,
25
- k as parseVector3,
26
- O as polar2Cartesian
27
+ C as parseVector2,
28
+ G as parseVector3
27
29
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gl-draw",
3
- "version": "0.17.0-beta.36",
3
+ "version": "0.17.0-beta.37",
4
4
  "author": "gitplus <hstits@gmail.com>",
5
5
  "scripts": {
6
6
  "start": "bundler-dev",
@@ -1 +0,0 @@
1
- "use strict";const e=require("three"),s=t=>t instanceof e.Vector3?t:new e.Vector3(...t),c=t=>t instanceof e.Vector2?t:new e.Vector2(...t);function i(t,o,r=0){const n=(90-o)*Math.PI/180,a=(90-t)*Math.PI/180;return[r*Math.sin(n)*Math.cos(a),r*Math.cos(n),r*Math.sin(n)*Math.sin(a)]}exports.parseVector2=c;exports.parseVector3=s;exports.polar2Cartesian=i;
@@ -1,18 +0,0 @@
1
- import { Vector3 as e, Vector2 as o } from "three";
2
- const i = (t) => t instanceof e ? t : new e(...t), h = (t) => t instanceof o ? t : new o(...t);
3
- function p(t, s, n = 0) {
4
- const a = (90 - s) * Math.PI / 180, r = (90 - t) * Math.PI / 180;
5
- return [
6
- n * Math.sin(a) * Math.cos(r),
7
- // x
8
- n * Math.cos(a),
9
- // y
10
- n * Math.sin(a) * Math.sin(r)
11
- // z
12
- ];
13
- }
14
- export {
15
- p as a,
16
- h as b,
17
- i as p
18
- };
@@ -1 +0,0 @@
1
- export declare function polar2Cartesian(lng: number, lat: number, r?: number): number[];