@math.gl/geospatial 4.0.0-alpha.1 → 4.0.0-alpha.3

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.
@@ -5,7 +5,7 @@ import type { AxisDirection } from './helpers/ellipsoid-transform';
5
5
  * `(x / a)^2 + (y / b)^2 + (z / c)^2 = 1`. Primarily used
6
6
  * to represent the shape of planetary bodies.
7
7
  */
8
- export default class Ellipsoid {
8
+ export declare class Ellipsoid {
9
9
  /** An Ellipsoid instance initialized to the WGS84 standard. */
10
10
  static readonly WGS84: Ellipsoid;
11
11
  readonly radii: Vector3;
@@ -1 +1 @@
1
- {"version":3,"file":"ellipsoid.d.ts","sourceRoot":"","sources":["../../src/ellipsoid/ellipsoid.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,OAAO,EAAE,OAAO,EAA8B,YAAY,EAAC,MAAM,eAAe,CAAC;AAOzF,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,+BAA+B,CAAC;AAWjE;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B,+DAA+D;IAC/D,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAiE;IAEjG,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAuB;IAC9D,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IAEtC,4FAA4F;gBAChF,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,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ACrD,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,MAAM,GAAE,MAAM,EAAc,GAAG,MAAM,EAAE;IAmBrF;kEAC8D;IAC9D,8BAA8B,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,MAAM,GAAE,MAAM,EAAc,GAAG,MAAM,EAAE;IAI1F;4DACwD;IACxD,gCAAgC,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,MAAM,GAAE,MAAM,EAAc,GAAG,MAAM,EAAE;IAI5F,wFAAwF;IACxF,qCAAqC,CACnC,QAAQ,EAAE,MAAM,EAAE,EAClB,MAAM,GAAE,MAAU,EAClB,MAAM,GAAE,MAAM,EAAc,GAC3B,MAAM,EAAE;CAcZ"}
@@ -3,15 +3,15 @@ import { Vector3, Matrix4, assert, equals, _MathUtils } from '@math.gl/core';
3
3
  import * as vec3 from 'gl-matrix/vec3';
4
4
  import { WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z } from "../constants.js";
5
5
  import { fromCartographicToRadians, toCartographicFromRadians } from "../type-utils.js";
6
- import localFrameToFixedFrame from "./helpers/ellipsoid-transform.js";
7
- import scaleToGeodeticSurface from "./helpers/scale-to-geodetic-surface.js";
6
+ import { localFrameToFixedFrame } from "./helpers/ellipsoid-transform.js";
7
+ import { scaleToGeodeticSurface } from "./helpers/scale-to-geodetic-surface.js";
8
8
  const scratchVector = new Vector3();
9
9
  const scratchNormal = new Vector3();
10
10
  const scratchK = new Vector3();
11
11
  const scratchPosition = new Vector3();
12
12
  const scratchHeight = new Vector3();
13
13
  const scratchCartesian = new Vector3();
14
- export default class Ellipsoid {
14
+ export class Ellipsoid {
15
15
  constructor(x = 0.0, y = 0.0, z = 0.0) {
16
16
  _defineProperty(this, "radii", void 0);
17
17
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ellipsoid/ellipsoid.ts"],"names":["Vector3","Matrix4","assert","equals","_MathUtils","vec3","WGS84_RADIUS_X","WGS84_RADIUS_Y","WGS84_RADIUS_Z","fromCartographicToRadians","toCartographicFromRadians","localFrameToFixedFrame","scaleToGeodeticSurface","scratchVector","scratchNormal","scratchK","scratchPosition","scratchHeight","scratchCartesian","Ellipsoid","constructor","x","y","z","EPSILON1","radii","radiiSquared","radiiToTheFourth","oneOverRadii","oneOverRadiiSquared","minimumRadius","Math","min","maximumRadius","max","squaredXOverSquaredZ","Object","freeze","right","Boolean","toString","cartographicToCartesian","cartographic","result","normal","k","height","geodeticSurfaceNormalCartographic","copy","scale","gamma","sqrt","dot","add","to","cartesianToCartographic","cartesian","from","point","undefined","geodeticSurfaceNormal","h","subtract","longitude","atan2","latitude","asin","sign","length","eastNorthUpToFixedFrame","origin","firstAxis","secondAxis","thirdAxis","geocentricSurfaceNormal","normalize","cartographicVectorRadians","cosLatitude","cos","set","sin","scaleToGeocentricSurface","positionX","positionY","positionZ","beta","multiplyScalar","transformPositionToScaledSpace","position","transformPositionFromScaledSpace","getSurfaceNormalIntersectionWithZAxis","buffer","EPSILON15","abs"],"mappings":";AAIA,SAAQA,OAAR,EAAiBC,OAAjB,EAA0BC,MAA1B,EAAkCC,MAAlC,EAA0CC,UAA1C,QAAyE,eAAzE;AAEA,OAAO,KAAKC,IAAZ,MAAsB,gBAAtB;SAEQC,c,EAAgBC,c,EAAgBC,c;SAChCC,yB,EAA2BC,yB;OAG5BC,sB;OACAC,sB;AAEP,MAAMC,aAAa,GAAG,IAAIb,OAAJ,EAAtB;AACA,MAAMc,aAAa,GAAG,IAAId,OAAJ,EAAtB;AACA,MAAMe,QAAQ,GAAG,IAAIf,OAAJ,EAAjB;AACA,MAAMgB,eAAe,GAAG,IAAIhB,OAAJ,EAAxB;AACA,MAAMiB,aAAa,GAAG,IAAIjB,OAAJ,EAAtB;AACA,MAAMkB,gBAAgB,GAAG,IAAIlB,OAAJ,EAAzB;AAOA,eAAe,MAAMmB,SAAN,CAAgB;AAkB7BC,EAAAA,WAAW,CAACC,CAAC,GAAG,GAAL,EAAUC,CAAC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,gCAAgC,CAACD,QAAD,EAAqB7C,MAAgB,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAAxC,EAA6D;AAC3F,WAAO3B,eAAe,CAACyC,IAAhB,CAAqB+B,QAArB,EAA+BvC,KAA/B,CAAqC,KAAKxB,KAA1C,EAAiD6B,EAAjD,CAAoDX,MAApD,CAAP;AACD;;AAGD+C,EAAAA,qCAAqC,CACnCF,QADmC,EAEnCG,MAAc,GAAG,CAFkB,EAGnChD,MAAgB,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAHgB,EAIzB;AAEVzC,IAAAA,MAAM,CAACC,MAAM,CAAC,KAAKsB,KAAL,CAAWJ,CAAZ,EAAe,KAAKI,KAAL,CAAWH,CAA1B,EAA6BlB,UAAU,CAACwF,SAAxC,CAAP,CAAN;AACA1F,IAAAA,MAAM,CAAC,KAAKuB,KAAL,CAAWF,CAAX,GAAe,CAAhB,CAAN;AAEAP,IAAAA,eAAe,CAACyC,IAAhB,CAAqB+B,QAArB;AACA,UAAMjE,CAAC,GAAGP,eAAe,CAACO,CAAhB,IAAqB,IAAI,KAAKY,oBAA9B,CAAV;;AAEA,QAAIJ,IAAI,CAAC8D,GAAL,CAAStE,CAAT,KAAe,KAAKE,KAAL,CAAWF,CAAX,GAAeoE,MAAlC,EAA0C;AACxC,aAAOhC,SAAP;AACD;;AAED,WAAO3C,eAAe,CAAC+D,GAAhB,CAAoB,GAApB,EAAyB,GAAzB,EAA8BxD,CAA9B,EAAiC+B,EAAjC,CAAoCX,MAApC,CAAP;AACD;;AAlP4B;;gBAAVxB,S,WAEgB,IAAIA,SAAJ,CAAcb,cAAd,EAA8BC,cAA9B,EAA8CC,cAA9C,C","sourcesContent":["// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n/* eslint-disable */\nimport {Vector3, Matrix4, assert, equals, _MathUtils, NumericArray} from '@math.gl/core';\n// @ts-ignore gl-matrix typings...\nimport * as vec3 from 'gl-matrix/vec3';\n\nimport {WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z} from '../constants';\nimport {fromCartographicToRadians, toCartographicFromRadians} from '../type-utils';\n\nimport type {AxisDirection} from './helpers/ellipsoid-transform';\nimport localFrameToFixedFrame from './helpers/ellipsoid-transform';\nimport scaleToGeodeticSurface from './helpers/scale-to-geodetic-surface';\n\nconst scratchVector = new Vector3();\nconst scratchNormal = new Vector3();\nconst scratchK = new Vector3();\nconst scratchPosition = new Vector3();\nconst scratchHeight = new Vector3();\nconst scratchCartesian = new Vector3();\n\n/**\n * A quadratic surface defined in Cartesian coordinates by the equation\n * `(x / a)^2 + (y / b)^2 + (z / c)^2 = 1`. Primarily used\n * to represent the shape of planetary bodies.\n */\nexport default class Ellipsoid {\n /** An Ellipsoid instance initialized to the WGS84 standard. */\n static readonly WGS84: Ellipsoid = new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);\n\n readonly radii: Vector3;\n readonly radiiSquared: Vector3;\n readonly radiiToTheFourth: Vector3;\n readonly oneOverRadii: Vector3;\n readonly oneOverRadiiSquared: Vector3;\n readonly minimumRadius: number;\n readonly maximumRadius: number;\n readonly centerToleranceSquared: number = _MathUtils.EPSILON1;\n readonly squaredXOverSquaredZ: number;\n\n /** Creates an Ellipsoid from a Cartesian specifying the radii in x, y, and z directions. */\n constructor(x: number, y: number, z: number);\n constructor();\n\n constructor(x = 0.0, y = 0.0, z = 0.0) {\n assert(x >= 0.0);\n assert(y >= 0.0);\n assert(z >= 0.0);\n\n this.radii = new Vector3(x, y, z);\n\n this.radiiSquared = new Vector3(x * x, y * y, z * z);\n\n this.radiiToTheFourth = new Vector3(x * x * x * x, y * y * y * y, z * z * z * z);\n\n this.oneOverRadii = new Vector3(\n x === 0.0 ? 0.0 : 1.0 / x,\n y === 0.0 ? 0.0 : 1.0 / y,\n z === 0.0 ? 0.0 : 1.0 / z\n );\n\n this.oneOverRadiiSquared = new Vector3(\n x === 0.0 ? 0.0 : 1.0 / (x * x),\n y === 0.0 ? 0.0 : 1.0 / (y * y),\n z === 0.0 ? 0.0 : 1.0 / (z * z)\n );\n\n this.minimumRadius = Math.min(x, y, z);\n\n this.maximumRadius = Math.max(x, y, z);\n\n if (this.radiiSquared.z !== 0) {\n this.squaredXOverSquaredZ = this.radiiSquared.x / this.radiiSquared.z;\n }\n\n Object.freeze(this);\n }\n\n /** Compares this Ellipsoid against the provided Ellipsoid componentwise */\n equals(right: Ellipsoid): boolean {\n return this === right || Boolean(right && this.radii.equals(right.radii));\n }\n\n /** Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'. */\n toString(): string {\n return this.radii.toString();\n }\n\n /** Converts the provided cartographic to Cartesian representation. */\n cartographicToCartesian(cartographic: number[], result: Vector3): Vector3;\n cartographicToCartesian(cartographic: number[], result?: number[]): number[];\n\n cartographicToCartesian(cartographic: Readonly<NumericArray>, result = [0, 0, 0]) {\n const normal = scratchNormal;\n const k = scratchK;\n\n const [, , height] = cartographic;\n this.geodeticSurfaceNormalCartographic(cartographic, normal);\n k.copy(this.radiiSquared).scale(normal);\n\n const gamma = Math.sqrt(normal.dot(k));\n k.scale(1 / gamma);\n\n normal.scale(height);\n\n k.add(normal);\n\n return k.to(result);\n }\n\n /** Converts the provided cartesian to cartographic (lng/lat/z) representation.\n * The cartesian is undefined at the center of the ellipsoid. */\n cartesianToCartographic(cartesian: Readonly<NumericArray>, result: Vector3): Vector3;\n cartesianToCartographic(cartesian: Readonly<NumericArray>, result?: number[]): number[];\n\n cartesianToCartographic(cartesian: Readonly<NumericArray>, result = [0, 0, 0]) {\n scratchCartesian.from(cartesian);\n const point = this.scaleToGeodeticSurface(scratchCartesian, scratchPosition);\n\n if (!point) {\n return undefined;\n }\n\n const normal = this.geodeticSurfaceNormal(point, scratchNormal);\n\n const h = scratchHeight;\n h.copy(scratchCartesian).subtract(point);\n\n const longitude = Math.atan2(normal.y, normal.x);\n const latitude = Math.asin(normal.z);\n const height = Math.sign(vec3.dot(h, scratchCartesian)) * vec3.length(h);\n\n return toCartographicFromRadians([longitude, latitude, height], result);\n }\n\n /** Computes a 4x4 transformation matrix from a reference frame with an east-north-up axes\n * centered at the provided origin to the provided ellipsoid's fixed reference frame. */\n eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result?: Matrix4): Matrix4;\n eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result: number[]): number[];\n\n eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result = new Matrix4()) {\n return localFrameToFixedFrame(this, 'east', 'north', 'up', origin, result);\n }\n\n /** Computes a 4x4 transformation matrix from a reference frame centered at\n * the provided origin to the ellipsoid's fixed reference frame.\n */\n localFrameToFixedFrame(\n firstAxis: AxisDirection,\n secondAxis: AxisDirection,\n thirdAxis: AxisDirection,\n origin: Readonly<NumericArray>,\n result?: Matrix4\n ): Matrix4;\n localFrameToFixedFrame<Matrix4T>(\n firstAxis: AxisDirection,\n secondAxis: AxisDirection,\n thirdAxis: AxisDirection,\n origin: Readonly<NumericArray>,\n result: number[]\n ): number[];\n\n // Computes a 4x4 transformation matrix from a reference frame centered at\n // the provided origin to the ellipsoid's fixed reference frame.\n localFrameToFixedFrame(\n firstAxis: AxisDirection,\n secondAxis: AxisDirection,\n thirdAxis: AxisDirection,\n origin: Readonly<NumericArray>,\n result = new Matrix4()\n ) {\n return localFrameToFixedFrame(this, firstAxis, secondAxis, thirdAxis, origin, result);\n }\n\n /** Computes the unit vector directed from the center of this ellipsoid toward\n * the provided Cartesian position. */\n geocentricSurfaceNormal(cartesian: number[], result?: number[]): number[];\n geocentricSurfaceNormal<NumArray>(cartesian: number[], result: NumArray): NumArray;\n geocentricSurfaceNormal(cartesian: Readonly<NumericArray>, result = [0, 0, 0]) {\n return scratchVector.from(cartesian).normalize().to(result);\n }\n\n /** Computes the normal of the plane tangent to the surface of the ellipsoid at provided position. */\n geodeticSurfaceNormalCartographic<NumArray>(\n cartographic: Readonly<NumericArray>,\n result: NumArray\n ): NumArray;\n geodeticSurfaceNormalCartographic(cartographic: number[]): number[];\n geodeticSurfaceNormalCartographic(cartographic: Readonly<NumericArray>, result = [0, 0, 0]) {\n const cartographicVectorRadians = fromCartographicToRadians(cartographic);\n\n const longitude = cartographicVectorRadians[0];\n const latitude = cartographicVectorRadians[1];\n\n const cosLatitude = Math.cos(latitude);\n\n scratchVector\n .set(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), Math.sin(latitude))\n .normalize();\n\n return scratchVector.to(result);\n }\n\n /** Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position. */\n geodeticSurfaceNormal<NumArrayT>(cartesian: number[], result: NumArrayT): NumArrayT;\n geodeticSurfaceNormal(cartesian: number[]): number[];\n geodeticSurfaceNormal(cartesian: Readonly<NumericArray>, result = [0, 0, 0]) {\n return scratchVector.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);\n }\n\n /** Scales the provided Cartesian position along the geodetic surface normal\n * so that it is on the surface of this ellipsoid. If the position is\n * at the center of the ellipsoid, this function returns undefined. */\n scaleToGeodeticSurface(cartesian: number[], result?: number[]): number[] {\n return scaleToGeodeticSurface(cartesian, this, result);\n }\n\n /** Scales the provided Cartesian position along the geocentric surface normal\n * so that it is on the surface of this ellipsoid. */\n scaleToGeocentricSurface(cartesian: number[], result: number[] = [0, 0, 0]): number[] {\n scratchPosition.from(cartesian);\n\n const positionX = scratchPosition.x;\n const positionY = scratchPosition.y;\n const positionZ = scratchPosition.z;\n const oneOverRadiiSquared = this.oneOverRadiiSquared;\n\n const beta =\n 1.0 /\n Math.sqrt(\n positionX * positionX * oneOverRadiiSquared.x +\n positionY * positionY * oneOverRadiiSquared.y +\n positionZ * positionZ * oneOverRadiiSquared.z\n );\n\n return scratchPosition.multiplyScalar(beta).to(result);\n }\n\n /** Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying\n * its components by the result of `Ellipsoid#oneOverRadii` */\n transformPositionToScaledSpace(position: number[], result: number[] = [0, 0, 0]): number[] {\n return scratchPosition.from(position).scale(this.oneOverRadii).to(result);\n }\n\n /** Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying\n * its components by the result of `Ellipsoid#radii`. */\n transformPositionFromScaledSpace(position: number[], result: number[] = [0, 0, 0]): number[] {\n return scratchPosition.from(position).scale(this.radii).to(result);\n }\n\n /** Computes a point which is the intersection of the surface normal with the z-axis. */\n getSurfaceNormalIntersectionWithZAxis(\n position: number[],\n buffer: number = 0,\n result: number[] = [0, 0, 0]\n ): number[] {\n // Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)\n assert(equals(this.radii.x, this.radii.y, _MathUtils.EPSILON15));\n assert(this.radii.z > 0);\n\n scratchPosition.from(position);\n const z = scratchPosition.z * (1 - this.squaredXOverSquaredZ);\n\n if (Math.abs(z) >= this.radii.z - buffer) {\n return undefined;\n }\n\n return scratchPosition.set(0.0, 0.0, z).to(result);\n }\n}\n"],"file":"ellipsoid.js"}
1
+ {"version":3,"sources":["../../src/ellipsoid/ellipsoid.ts"],"names":["Vector3","Matrix4","assert","equals","_MathUtils","vec3","WGS84_RADIUS_X","WGS84_RADIUS_Y","WGS84_RADIUS_Z","fromCartographicToRadians","toCartographicFromRadians","localFrameToFixedFrame","scaleToGeodeticSurface","scratchVector","scratchNormal","scratchK","scratchPosition","scratchHeight","scratchCartesian","Ellipsoid","constructor","x","y","z","EPSILON1","radii","radiiSquared","radiiToTheFourth","oneOverRadii","oneOverRadiiSquared","minimumRadius","Math","min","maximumRadius","max","squaredXOverSquaredZ","Object","freeze","right","Boolean","toString","cartographicToCartesian","cartographic","result","normal","k","height","geodeticSurfaceNormalCartographic","copy","scale","gamma","sqrt","dot","add","to","cartesianToCartographic","cartesian","from","point","undefined","geodeticSurfaceNormal","h","subtract","longitude","atan2","latitude","asin","sign","length","eastNorthUpToFixedFrame","origin","firstAxis","secondAxis","thirdAxis","geocentricSurfaceNormal","normalize","cartographicVectorRadians","cosLatitude","cos","set","sin","scaleToGeocentricSurface","positionX","positionY","positionZ","beta","multiplyScalar","transformPositionToScaledSpace","position","transformPositionFromScaledSpace","getSurfaceNormalIntersectionWithZAxis","buffer","EPSILON15","abs"],"mappings":";AAIA,SAAQA,OAAR,EAAiBC,OAAjB,EAA0BC,MAA1B,EAAkCC,MAAlC,EAA0CC,UAA1C,QAAyE,eAAzE;AAEA,OAAO,KAAKC,IAAZ,MAAsB,gBAAtB;SAEQC,c,EAAgBC,c,EAAgBC,c;SAChCC,yB,EAA2BC,yB;SAG3BC,sB;SACAC,sB;AAER,MAAMC,aAAa,GAAG,IAAIb,OAAJ,EAAtB;AACA,MAAMc,aAAa,GAAG,IAAId,OAAJ,EAAtB;AACA,MAAMe,QAAQ,GAAG,IAAIf,OAAJ,EAAjB;AACA,MAAMgB,eAAe,GAAG,IAAIhB,OAAJ,EAAxB;AACA,MAAMiB,aAAa,GAAG,IAAIjB,OAAJ,EAAtB;AACA,MAAMkB,gBAAgB,GAAG,IAAIlB,OAAJ,EAAzB;AAOA,OAAO,MAAMmB,SAAN,CAAgB;AAkBrBC,EAAAA,WAAW,CAACC,CAAC,GAAG,GAAL,EAAUC,CAAC,GAAG,GAAd,EAAmBC,CAAC,GAAG,GAAvB,EAA4B;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,oDAPGnB,UAAU,CAACoB,QAOd;;AAAA;;AACrCtB,IAAAA,MAAM,CAACmB,CAAC,IAAI,GAAN,CAAN;AACAnB,IAAAA,MAAM,CAACoB,CAAC,IAAI,GAAN,CAAN;AACApB,IAAAA,MAAM,CAACqB,CAAC,IAAI,GAAN,CAAN;AAEA,SAAKE,KAAL,GAAa,IAAIzB,OAAJ,CAAYqB,CAAZ,EAAeC,CAAf,EAAkBC,CAAlB,CAAb;AAEA,SAAKG,YAAL,GAAoB,IAAI1B,OAAJ,CAAYqB,CAAC,GAAGA,CAAhB,EAAmBC,CAAC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EAA6BlB,UAAU,CAACwF,SAAxC,CAAP,CAAN;AACA1F,IAAAA,MAAM,CAAC,KAAKuB,KAAL,CAAWF,CAAX,GAAe,CAAhB,CAAN;AAEAP,IAAAA,eAAe,CAACyC,IAAhB,CAAqB+B,QAArB;AACA,UAAMjE,CAAC,GAAGP,eAAe,CAACO,CAAhB,IAAqB,IAAI,KAAKY,oBAA9B,CAAV;;AAEA,QAAIJ,IAAI,CAAC8D,GAAL,CAAStE,CAAT,KAAe,KAAKE,KAAL,CAAWF,CAAX,GAAeoE,MAAlC,EAA0C;AACxC,aAAOhC,SAAP;AACD;;AAED,WAAO3C,eAAe,CAAC+D,GAAhB,CAAoB,GAApB,EAAyB,GAAzB,EAA8BxD,CAA9B,EAAiC+B,EAAjC,CAAoCX,MAApC,CAAP;AACD;;AAlPoB;;gBAAVxB,S,WAEwB,IAAIA,SAAJ,CAAcb,cAAd,EAA8BC,cAA9B,EAA8CC,cAA9C,C","sourcesContent":["// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n/* eslint-disable */\nimport {Vector3, Matrix4, assert, equals, _MathUtils, NumericArray} from '@math.gl/core';\n// @ts-ignore gl-matrix typings...\nimport * as vec3 from 'gl-matrix/vec3';\n\nimport {WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z} from '../constants';\nimport {fromCartographicToRadians, toCartographicFromRadians} from '../type-utils';\n\nimport type {AxisDirection} from './helpers/ellipsoid-transform';\nimport {localFrameToFixedFrame} from './helpers/ellipsoid-transform';\nimport {scaleToGeodeticSurface} from './helpers/scale-to-geodetic-surface';\n\nconst scratchVector = new Vector3();\nconst scratchNormal = new Vector3();\nconst scratchK = new Vector3();\nconst scratchPosition = new Vector3();\nconst scratchHeight = new Vector3();\nconst scratchCartesian = new Vector3();\n\n/**\n * A quadratic surface defined in Cartesian coordinates by the equation\n * `(x / a)^2 + (y / b)^2 + (z / c)^2 = 1`. Primarily used\n * to represent the shape of planetary bodies.\n */\nexport class Ellipsoid {\n /** An Ellipsoid instance initialized to the WGS84 standard. */\n static readonly WGS84: Ellipsoid = new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);\n\n readonly radii: Vector3;\n readonly radiiSquared: Vector3;\n readonly radiiToTheFourth: Vector3;\n readonly oneOverRadii: Vector3;\n readonly oneOverRadiiSquared: Vector3;\n readonly minimumRadius: number;\n readonly maximumRadius: number;\n readonly centerToleranceSquared: number = _MathUtils.EPSILON1;\n readonly squaredXOverSquaredZ: number;\n\n /** Creates an Ellipsoid from a Cartesian specifying the radii in x, y, and z directions. */\n constructor(x: number, y: number, z: number);\n constructor();\n\n constructor(x = 0.0, y = 0.0, z = 0.0) {\n assert(x >= 0.0);\n assert(y >= 0.0);\n assert(z >= 0.0);\n\n this.radii = new Vector3(x, y, z);\n\n this.radiiSquared = new Vector3(x * x, y * y, z * z);\n\n this.radiiToTheFourth = new Vector3(x * x * x * x, y * y * y * y, z * z * z * z);\n\n this.oneOverRadii = new Vector3(\n x === 0.0 ? 0.0 : 1.0 / x,\n y === 0.0 ? 0.0 : 1.0 / y,\n z === 0.0 ? 0.0 : 1.0 / z\n );\n\n this.oneOverRadiiSquared = new Vector3(\n x === 0.0 ? 0.0 : 1.0 / (x * x),\n y === 0.0 ? 0.0 : 1.0 / (y * y),\n z === 0.0 ? 0.0 : 1.0 / (z * z)\n );\n\n this.minimumRadius = Math.min(x, y, z);\n\n this.maximumRadius = Math.max(x, y, z);\n\n if (this.radiiSquared.z !== 0) {\n this.squaredXOverSquaredZ = this.radiiSquared.x / this.radiiSquared.z;\n }\n\n Object.freeze(this);\n }\n\n /** Compares this Ellipsoid against the provided Ellipsoid componentwise */\n equals(right: Ellipsoid): boolean {\n return this === right || Boolean(right && this.radii.equals(right.radii));\n }\n\n /** Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'. */\n toString(): string {\n return this.radii.toString();\n }\n\n /** Converts the provided cartographic to Cartesian representation. */\n cartographicToCartesian(cartographic: number[], result: Vector3): Vector3;\n cartographicToCartesian(cartographic: number[], result?: number[]): number[];\n\n cartographicToCartesian(cartographic: Readonly<NumericArray>, result = [0, 0, 0]) {\n const normal = scratchNormal;\n const k = scratchK;\n\n const [, , height] = cartographic;\n this.geodeticSurfaceNormalCartographic(cartographic, normal);\n k.copy(this.radiiSquared).scale(normal);\n\n const gamma = Math.sqrt(normal.dot(k));\n k.scale(1 / gamma);\n\n normal.scale(height);\n\n k.add(normal);\n\n return k.to(result);\n }\n\n /** Converts the provided cartesian to cartographic (lng/lat/z) representation.\n * The cartesian is undefined at the center of the ellipsoid. */\n cartesianToCartographic(cartesian: Readonly<NumericArray>, result: Vector3): Vector3;\n cartesianToCartographic(cartesian: Readonly<NumericArray>, result?: number[]): number[];\n\n cartesianToCartographic(cartesian: Readonly<NumericArray>, result = [0, 0, 0]) {\n scratchCartesian.from(cartesian);\n const point = this.scaleToGeodeticSurface(scratchCartesian, scratchPosition);\n\n if (!point) {\n return undefined;\n }\n\n const normal = this.geodeticSurfaceNormal(point, scratchNormal);\n\n const h = scratchHeight;\n h.copy(scratchCartesian).subtract(point);\n\n const longitude = Math.atan2(normal.y, normal.x);\n const latitude = Math.asin(normal.z);\n const height = Math.sign(vec3.dot(h, scratchCartesian)) * vec3.length(h);\n\n return toCartographicFromRadians([longitude, latitude, height], result);\n }\n\n /** Computes a 4x4 transformation matrix from a reference frame with an east-north-up axes\n * centered at the provided origin to the provided ellipsoid's fixed reference frame. */\n eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result?: Matrix4): Matrix4;\n eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result: number[]): number[];\n\n eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result = new Matrix4()) {\n return localFrameToFixedFrame(this, 'east', 'north', 'up', origin, result);\n }\n\n /** Computes a 4x4 transformation matrix from a reference frame centered at\n * the provided origin to the ellipsoid's fixed reference frame.\n */\n localFrameToFixedFrame(\n firstAxis: AxisDirection,\n secondAxis: AxisDirection,\n thirdAxis: AxisDirection,\n origin: Readonly<NumericArray>,\n result?: Matrix4\n ): Matrix4;\n localFrameToFixedFrame<Matrix4T>(\n firstAxis: AxisDirection,\n secondAxis: AxisDirection,\n thirdAxis: AxisDirection,\n origin: Readonly<NumericArray>,\n result: number[]\n ): number[];\n\n // Computes a 4x4 transformation matrix from a reference frame centered at\n // the provided origin to the ellipsoid's fixed reference frame.\n localFrameToFixedFrame(\n firstAxis: AxisDirection,\n secondAxis: AxisDirection,\n thirdAxis: AxisDirection,\n origin: Readonly<NumericArray>,\n result = new Matrix4()\n ) {\n return localFrameToFixedFrame(this, firstAxis, secondAxis, thirdAxis, origin, result);\n }\n\n /** Computes the unit vector directed from the center of this ellipsoid toward\n * the provided Cartesian position. */\n geocentricSurfaceNormal(cartesian: number[], result?: number[]): number[];\n geocentricSurfaceNormal<NumArray>(cartesian: number[], result: NumArray): NumArray;\n geocentricSurfaceNormal(cartesian: Readonly<NumericArray>, result = [0, 0, 0]) {\n return scratchVector.from(cartesian).normalize().to(result);\n }\n\n /** Computes the normal of the plane tangent to the surface of the ellipsoid at provided position. */\n geodeticSurfaceNormalCartographic<NumArray>(\n cartographic: Readonly<NumericArray>,\n result: NumArray\n ): NumArray;\n geodeticSurfaceNormalCartographic(cartographic: number[]): number[];\n geodeticSurfaceNormalCartographic(cartographic: Readonly<NumericArray>, result = [0, 0, 0]) {\n const cartographicVectorRadians = fromCartographicToRadians(cartographic);\n\n const longitude = cartographicVectorRadians[0];\n const latitude = cartographicVectorRadians[1];\n\n const cosLatitude = Math.cos(latitude);\n\n scratchVector\n .set(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), Math.sin(latitude))\n .normalize();\n\n return scratchVector.to(result);\n }\n\n /** Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position. */\n geodeticSurfaceNormal<NumArrayT>(cartesian: number[], result: NumArrayT): NumArrayT;\n geodeticSurfaceNormal(cartesian: number[]): number[];\n geodeticSurfaceNormal(cartesian: Readonly<NumericArray>, result = [0, 0, 0]) {\n return scratchVector.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);\n }\n\n /** Scales the provided Cartesian position along the geodetic surface normal\n * so that it is on the surface of this ellipsoid. If the position is\n * at the center of the ellipsoid, this function returns undefined. */\n scaleToGeodeticSurface(cartesian: number[], result?: number[]): number[] {\n return scaleToGeodeticSurface(cartesian, this, result);\n }\n\n /** Scales the provided Cartesian position along the geocentric surface normal\n * so that it is on the surface of this ellipsoid. */\n scaleToGeocentricSurface(cartesian: number[], result: number[] = [0, 0, 0]): number[] {\n scratchPosition.from(cartesian);\n\n const positionX = scratchPosition.x;\n const positionY = scratchPosition.y;\n const positionZ = scratchPosition.z;\n const oneOverRadiiSquared = this.oneOverRadiiSquared;\n\n const beta =\n 1.0 /\n Math.sqrt(\n positionX * positionX * oneOverRadiiSquared.x +\n positionY * positionY * oneOverRadiiSquared.y +\n positionZ * positionZ * oneOverRadiiSquared.z\n );\n\n return scratchPosition.multiplyScalar(beta).to(result);\n }\n\n /** Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying\n * its components by the result of `Ellipsoid#oneOverRadii` */\n transformPositionToScaledSpace(position: number[], result: number[] = [0, 0, 0]): number[] {\n return scratchPosition.from(position).scale(this.oneOverRadii).to(result);\n }\n\n /** Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying\n * its components by the result of `Ellipsoid#radii`. */\n transformPositionFromScaledSpace(position: number[], result: number[] = [0, 0, 0]): number[] {\n return scratchPosition.from(position).scale(this.radii).to(result);\n }\n\n /** Computes a point which is the intersection of the surface normal with the z-axis. */\n getSurfaceNormalIntersectionWithZAxis(\n position: number[],\n buffer: number = 0,\n result: number[] = [0, 0, 0]\n ): number[] {\n // Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)\n assert(equals(this.radii.x, this.radii.y, _MathUtils.EPSILON15));\n assert(this.radii.z > 0);\n\n scratchPosition.from(position);\n const z = scratchPosition.z * (1 - this.squaredXOverSquaredZ);\n\n if (Math.abs(z) >= this.radii.z - buffer) {\n return undefined;\n }\n\n return scratchPosition.set(0.0, 0.0, z).to(result);\n }\n}\n"],"file":"ellipsoid.js"}
@@ -1,5 +1,5 @@
1
1
  import { NumericArray } from '@math.gl/core';
2
- import type Ellipsoid from '../ellipsoid';
3
- export type AxisDirection = 'up' | 'down' | 'north' | 'east' | 'south' | 'west';
4
- export default function localFrameToFixedFrame(ellipsoid: Ellipsoid, firstAxis: AxisDirection, secondAxis: AxisDirection, thirdAxis: AxisDirection, cartesianOrigin: Readonly<NumericArray>, result: number[]): number[];
2
+ import type { Ellipsoid } from '../ellipsoid';
3
+ export declare type AxisDirection = 'up' | 'down' | 'north' | 'east' | 'south' | 'west';
4
+ export declare function localFrameToFixedFrame(ellipsoid: Ellipsoid, firstAxis: AxisDirection, secondAxis: AxisDirection, thirdAxis: AxisDirection, cartesianOrigin: Readonly<NumericArray>, result: number[]): number[];
5
5
  //# sourceMappingURL=ellipsoid-transform.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ellipsoid-transform.d.ts","sourceRoot":"","sources":["../../../src/ellipsoid/helpers/ellipsoid-transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAA2C,MAAM,eAAe,CAAC;AAErF,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAM1C,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAsEhF,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,SAAS,EAAE,aAAa,EACxB,eAAe,EAAE,QAAQ,CAAC,YAAY,CAAC,EACvC,MAAM,EAAE,MAAM,EAAE,GACf,MAAM,EAAE,CAuEV"}
1
+ {"version":3,"file":"ellipsoid-transform.d.ts","sourceRoot":"","sources":["../../../src/ellipsoid/helpers/ellipsoid-transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAA2C,MAAM,eAAe,CAAC;AAErF,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAM5C,oBAAY,aAAa,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAsEhF,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,SAAS,EAAE,aAAa,EACxB,eAAe,EAAE,QAAQ,CAAC,YAAY,CAAC,EACvC,MAAM,EAAE,MAAM,EAAE,GACf,MAAM,EAAE,CAuEV"}
@@ -58,7 +58,7 @@ const scratchAxisVectors = {
58
58
  const scratchVector1 = new Vector3();
59
59
  const scratchVector2 = new Vector3();
60
60
  const scratchVector3 = new Vector3();
61
- export default function localFrameToFixedFrame(ellipsoid, firstAxis, secondAxis, thirdAxis, cartesianOrigin, result) {
61
+ export function localFrameToFixedFrame(ellipsoid, firstAxis, secondAxis, thirdAxis, cartesianOrigin, result) {
62
62
  const thirdAxisInferred = VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] && VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis];
63
63
  assert(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));
64
64
  let firstAxisVector;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ellipsoid/helpers/ellipsoid-transform.ts"],"names":["Vector3","assert","equals","equalsEpsilon","EPSILON14","scratchOrigin","VECTOR_PRODUCT_LOCAL_FRAME","up","south","north","west","east","down","degeneratePositionLocalFrame","scratchAxisVectors","scratchVector1","scratchVector2","scratchVector3","localFrameToFixedFrame","ellipsoid","firstAxis","secondAxis","thirdAxis","cartesianOrigin","result","thirdAxisInferred","firstAxisVector","secondAxisVector","thirdAxisVector","origin","copy","atPole","x","y","sign","Math","z","fromArray","scale","set","normalize","geodeticSurfaceNormal","cross"],"mappings":"AAAA,SAAsBA,OAAtB,EAA+BC,MAA/B,EAAuCC,MAAM,IAAIC,aAAjD,QAAqE,eAArE;AAIA,MAAMC,SAAS,GAAG,KAAlB;AAEA,MAAMC,aAAa,GAAG,IAAIL,OAAJ,EAAtB;AAKA,MAAMM,0BAGL,GAAG;AACFC,EAAAA,EAAE,EAAE;AACFC,IAAAA,KAAK,EAAE,MADL;AAEFC,IAAAA,KAAK,EAAE,MAFL;AAGFC,IAAAA,IAAI,EAAE,OAHJ;AAIFC,IAAAA,IAAI,EAAE;AAJJ,GADF;AAOFC,EAAAA,IAAI,EAAE;AACJJ,IAAAA,KAAK,EAAE,MADH;AAEJC,IAAAA,KAAK,EAAE,MAFH;AAGJC,IAAAA,IAAI,EAAE,OAHF;AAIJC,IAAAA,IAAI,EAAE;AAJF,GAPJ;AAaFH,EAAAA,KAAK,EAAE;AACLD,IAAAA,EAAE,EAAE,MADC;AAELK,IAAAA,IAAI,EAAE,MAFD;AAGLF,IAAAA,IAAI,EAAE,MAHD;AAILC,IAAAA,IAAI,EAAE;AAJD,GAbL;AAmBFF,EAAAA,KAAK,EAAE;AACLF,IAAAA,EAAE,EAAE,MADC;AAELK,IAAAA,IAAI,EAAE,MAFD;AAGLF,IAAAA,IAAI,EAAE,IAHD;AAILC,IAAAA,IAAI,EAAE;AAJD,GAnBL;AAyBFD,EAAAA,IAAI,EAAE;AACJH,IAAAA,EAAE,EAAE,OADA;AAEJK,IAAAA,IAAI,EAAE,OAFF;AAGJH,IAAAA,KAAK,EAAE,MAHH;AAIJD,IAAAA,KAAK,EAAE;AAJH,GAzBJ;AA+BFG,EAAAA,IAAI,EAAE;AACJJ,IAAAA,EAAE,EAAE,OADA;AAEJK,IAAAA,IAAI,EAAE,OAFF;AAGJH,IAAAA,KAAK,EAAE,IAHH;AAIJD,IAAAA,KAAK,EAAE;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A,MAAM,CAAC,CAAD,CAAN,GAAY,GAAZ;AACAA,EAAAA,MAAM,CAAC,CAAD,CAAN,GAAYI,eAAe,CAACI,CAA5B;AACAR,EAAAA,MAAM,CAAC,CAAD,CAAN,GAAYI,eAAe,CAACK,CAA5B;AACAT,EAAAA,MAAM,CAAC,EAAD,CAAN,GAAaI,eAAe,CAACQ,CAA7B;AACAZ,EAAAA,MAAM,CAAC,EAAD,CAAN,GAAa,GAAb;AACAA,EAAAA,MAAM,CAAC,EAAD,CAAN,GAAaK,MAAM,CAACG,CAApB;AACAR,EAAAA,MAAM,CAAC,EAAD,CAAN,GAAaK,MAAM,CAACI,CAApB;AACAT,EAAAA,MAAM,CAAC,EAAD,CAAN,GAAaK,MAAM,CAACO,CAApB;AACAZ,EAAAA,MAAM,CAAC,EAAD,CAAN,GAAa,GAAb;AACA,SAAOA,MAAP;AACD","sourcesContent":["import {NumericArray, Vector3, assert, equals as equalsEpsilon} from '@math.gl/core';\n\nimport type Ellipsoid from '../ellipsoid';\n\nconst EPSILON14 = 1e-14;\n\nconst scratchOrigin = new Vector3();\n\nexport type AxisDirection = 'up' | 'down' | 'north' | 'east' | 'south' | 'west';\n\n// Caclulate third axis from given two axii\nconst VECTOR_PRODUCT_LOCAL_FRAME: Record<\n AxisDirection,\n Partial<Record<AxisDirection, AxisDirection>>\n> = {\n up: {\n south: 'east',\n north: 'west',\n west: 'south',\n east: 'north'\n },\n down: {\n south: 'west',\n north: 'east',\n west: 'north',\n east: 'south'\n },\n south: {\n up: 'west',\n down: 'east',\n west: 'down',\n east: 'up'\n },\n north: {\n up: 'east',\n down: 'west',\n west: 'up',\n east: 'down'\n },\n west: {\n up: 'north',\n down: 'south',\n north: 'down',\n south: 'up'\n },\n east: {\n up: 'south',\n down: 'north',\n north: 'up',\n south: 'down'\n }\n} as const;\n\nconst degeneratePositionLocalFrame = {\n north: [-1, 0, 0],\n east: [0, 1, 0],\n up: [0, 0, 1],\n south: [1, 0, 0],\n west: [0, -1, 0],\n down: [0, 0, -1]\n} as const;\n\nconst scratchAxisVectors = {\n east: new Vector3(),\n north: new Vector3(),\n up: new Vector3(),\n west: new Vector3(),\n south: new Vector3(),\n down: new Vector3()\n};\n\nconst scratchVector1 = new Vector3();\nconst scratchVector2 = new Vector3();\nconst scratchVector3 = new Vector3();\n\n// Computes a 4x4 transformation matrix from a reference frame\n// centered at the provided origin to the provided ellipsoid's fixed reference frame.\n// eslint-disable-next-line max-statements, max-params, complexity\nexport default function localFrameToFixedFrame(\n ellipsoid: Ellipsoid,\n firstAxis: AxisDirection,\n secondAxis: AxisDirection,\n thirdAxis: AxisDirection,\n cartesianOrigin: Readonly<NumericArray>,\n result: number[]\n): number[] {\n const thirdAxisInferred =\n VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] && VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis];\n // firstAxis and secondAxis must be east, north, up, west, south or down.');\n assert(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));\n\n let firstAxisVector: Vector3;\n let secondAxisVector: Vector3;\n let thirdAxisVector: Vector3;\n\n const origin = scratchOrigin.copy(cartesianOrigin);\n\n // If x and y are zero, assume origin is at a pole, which is a special case.\n const atPole = equalsEpsilon(origin.x, 0.0, EPSILON14) && equalsEpsilon(origin.y, 0.0, EPSILON14);\n\n if (atPole) {\n // Look up axis value and adjust\n const sign = Math.sign(origin.z);\n\n firstAxisVector = scratchVector1.fromArray(degeneratePositionLocalFrame[firstAxis]);\n if (firstAxis !== 'east' && firstAxis !== 'west') {\n firstAxisVector.scale(sign);\n }\n\n secondAxisVector = scratchVector2.fromArray(degeneratePositionLocalFrame[secondAxis]);\n if (secondAxis !== 'east' && secondAxis !== 'west') {\n secondAxisVector.scale(sign);\n }\n\n thirdAxisVector = scratchVector3.fromArray(degeneratePositionLocalFrame[thirdAxis]);\n if (thirdAxis !== 'east' && thirdAxis !== 'west') {\n thirdAxisVector.scale(sign);\n }\n } else {\n // Calculate all axis\n const {up, east, north} = scratchAxisVectors;\n\n east.set(-origin.y, origin.x, 0.0).normalize();\n ellipsoid.geodeticSurfaceNormal(origin, up);\n north.copy(up).cross(east);\n\n const {down, west, south} = scratchAxisVectors;\n\n down.copy(up).scale(-1);\n west.copy(east).scale(-1);\n south.copy(north).scale(-1);\n\n // Pick three axis based on desired orientation\n firstAxisVector = scratchAxisVectors[firstAxis];\n secondAxisVector = scratchAxisVectors[secondAxis];\n thirdAxisVector = scratchAxisVectors[thirdAxis];\n }\n\n // TODO - assuming the result is column-major\n result[0] = firstAxisVector.x;\n result[1] = firstAxisVector.y;\n result[2] = firstAxisVector.z;\n result[3] = 0.0;\n result[4] = secondAxisVector.x;\n result[5] = secondAxisVector.y;\n result[6] = secondAxisVector.z;\n result[7] = 0.0;\n result[8] = thirdAxisVector.x;\n result[9] = thirdAxisVector.y;\n result[10] = thirdAxisVector.z;\n result[11] = 0.0;\n result[12] = origin.x;\n result[13] = origin.y;\n result[14] = origin.z;\n result[15] = 1.0;\n return result;\n}\n"],"file":"ellipsoid-transform.js"}
1
+ {"version":3,"sources":["../../../src/ellipsoid/helpers/ellipsoid-transform.ts"],"names":["Vector3","assert","equals","equalsEpsilon","EPSILON14","scratchOrigin","VECTOR_PRODUCT_LOCAL_FRAME","up","south","north","west","east","down","degeneratePositionLocalFrame","scratchAxisVectors","scratchVector1","scratchVector2","scratchVector3","localFrameToFixedFrame","ellipsoid","firstAxis","secondAxis","thirdAxis","cartesianOrigin","result","thirdAxisInferred","firstAxisVector","secondAxisVector","thirdAxisVector","origin","copy","atPole","x","y","sign","Math","z","fromArray","scale","set","normalize","geodeticSurfaceNormal","cross"],"mappings":"AAAA,SAAsBA,OAAtB,EAA+BC,MAA/B,EAAuCC,MAAM,IAAIC,aAAjD,QAAqE,eAArE;AAIA,MAAMC,SAAS,GAAG,KAAlB;AAEA,MAAMC,aAAa,GAAG,IAAIL,OAAJ,EAAtB;AAKA,MAAMM,0BAGL,GAAG;AACFC,EAAAA,EAAE,EAAE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AC,EAAD,CAAN,GAAaK,MAAM,CAACG,CAApB;AACAR,EAAAA,MAAM,CAAC,EAAD,CAAN,GAAaK,MAAM,CAACI,CAApB;AACAT,EAAAA,MAAM,CAAC,EAAD,CAAN,GAAaK,MAAM,CAACO,CAApB;AACAZ,EAAAA,MAAM,CAAC,EAAD,CAAN,GAAa,GAAb;AACA,SAAOA,MAAP;AACD","sourcesContent":["import {NumericArray, Vector3, assert, equals as equalsEpsilon} from '@math.gl/core';\n\nimport type {Ellipsoid} from '../ellipsoid';\n\nconst EPSILON14 = 1e-14;\n\nconst scratchOrigin = new Vector3();\n\nexport type AxisDirection = 'up' | 'down' | 'north' | 'east' | 'south' | 'west';\n\n// Caclulate third axis from given two axii\nconst VECTOR_PRODUCT_LOCAL_FRAME: Record<\n AxisDirection,\n Partial<Record<AxisDirection, AxisDirection>>\n> = {\n up: {\n south: 'east',\n north: 'west',\n west: 'south',\n east: 'north'\n },\n down: {\n south: 'west',\n north: 'east',\n west: 'north',\n east: 'south'\n },\n south: {\n up: 'west',\n down: 'east',\n west: 'down',\n east: 'up'\n },\n north: {\n up: 'east',\n down: 'west',\n west: 'up',\n east: 'down'\n },\n west: {\n up: 'north',\n down: 'south',\n north: 'down',\n south: 'up'\n },\n east: {\n up: 'south',\n down: 'north',\n north: 'up',\n south: 'down'\n }\n} as const;\n\nconst degeneratePositionLocalFrame = {\n north: [-1, 0, 0],\n east: [0, 1, 0],\n up: [0, 0, 1],\n south: [1, 0, 0],\n west: [0, -1, 0],\n down: [0, 0, -1]\n} as const;\n\nconst scratchAxisVectors = {\n east: new Vector3(),\n north: new Vector3(),\n up: new Vector3(),\n west: new Vector3(),\n south: new Vector3(),\n down: new Vector3()\n};\n\nconst scratchVector1 = new Vector3();\nconst scratchVector2 = new Vector3();\nconst scratchVector3 = new Vector3();\n\n// Computes a 4x4 transformation matrix from a reference frame\n// centered at the provided origin to the provided ellipsoid's fixed reference frame.\n// eslint-disable-next-line max-statements, max-params, complexity\nexport function localFrameToFixedFrame(\n ellipsoid: Ellipsoid,\n firstAxis: AxisDirection,\n secondAxis: AxisDirection,\n thirdAxis: AxisDirection,\n cartesianOrigin: Readonly<NumericArray>,\n result: number[]\n): number[] {\n const thirdAxisInferred =\n VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] && VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis];\n // firstAxis and secondAxis must be east, north, up, west, south or down.');\n assert(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));\n\n let firstAxisVector: Vector3;\n let secondAxisVector: Vector3;\n let thirdAxisVector: Vector3;\n\n const origin = scratchOrigin.copy(cartesianOrigin);\n\n // If x and y are zero, assume origin is at a pole, which is a special case.\n const atPole = equalsEpsilon(origin.x, 0.0, EPSILON14) && equalsEpsilon(origin.y, 0.0, EPSILON14);\n\n if (atPole) {\n // Look up axis value and adjust\n const sign = Math.sign(origin.z);\n\n firstAxisVector = scratchVector1.fromArray(degeneratePositionLocalFrame[firstAxis]);\n if (firstAxis !== 'east' && firstAxis !== 'west') {\n firstAxisVector.scale(sign);\n }\n\n secondAxisVector = scratchVector2.fromArray(degeneratePositionLocalFrame[secondAxis]);\n if (secondAxis !== 'east' && secondAxis !== 'west') {\n secondAxisVector.scale(sign);\n }\n\n thirdAxisVector = scratchVector3.fromArray(degeneratePositionLocalFrame[thirdAxis]);\n if (thirdAxis !== 'east' && thirdAxis !== 'west') {\n thirdAxisVector.scale(sign);\n }\n } else {\n // Calculate all axis\n const {up, east, north} = scratchAxisVectors;\n\n east.set(-origin.y, origin.x, 0.0).normalize();\n ellipsoid.geodeticSurfaceNormal(origin, up);\n north.copy(up).cross(east);\n\n const {down, west, south} = scratchAxisVectors;\n\n down.copy(up).scale(-1);\n west.copy(east).scale(-1);\n south.copy(north).scale(-1);\n\n // Pick three axis based on desired orientation\n firstAxisVector = scratchAxisVectors[firstAxis];\n secondAxisVector = scratchAxisVectors[secondAxis];\n thirdAxisVector = scratchAxisVectors[thirdAxis];\n }\n\n // TODO - assuming the result is column-major\n result[0] = firstAxisVector.x;\n result[1] = firstAxisVector.y;\n result[2] = firstAxisVector.z;\n result[3] = 0.0;\n result[4] = secondAxisVector.x;\n result[5] = secondAxisVector.y;\n result[6] = secondAxisVector.z;\n result[7] = 0.0;\n result[8] = thirdAxisVector.x;\n result[9] = thirdAxisVector.y;\n result[10] = thirdAxisVector.z;\n result[11] = 0.0;\n result[12] = origin.x;\n result[13] = origin.y;\n result[14] = origin.z;\n result[15] = 1.0;\n return result;\n}\n"],"file":"ellipsoid-transform.js"}
@@ -1,3 +1,3 @@
1
- import type Ellipsoid from '../ellipsoid';
2
- export default function scaleToGeodeticSurface(cartesian: number[], ellipsoid: Ellipsoid, result?: number[]): number[];
1
+ import type { Ellipsoid } from '../ellipsoid';
2
+ export declare function scaleToGeodeticSurface(cartesian: number[], ellipsoid: Ellipsoid, result?: number[]): number[];
3
3
  //# sourceMappingURL=scale-to-geodetic-surface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scale-to-geodetic-surface.d.ts","sourceRoot":"","sources":["../../../src/ellipsoid/helpers/scale-to-geodetic-surface.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAS1C,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,SAAS,EAAE,MAAM,EAAE,EACnB,SAAS,EAAE,SAAS,EACpB,MAAM,GAAE,MAAM,EAAO,GACpB,MAAM,EAAE,CAuFV"}
1
+ {"version":3,"file":"scale-to-geodetic-surface.d.ts","sourceRoot":"","sources":["../../../src/ellipsoid/helpers/scale-to-geodetic-surface.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAS5C,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EAAE,EACnB,SAAS,EAAE,SAAS,EACpB,MAAM,GAAE,MAAM,EAAO,GACpB,MAAM,EAAE,CAuFV"}
@@ -2,7 +2,7 @@ import { Vector3, _MathUtils } from '@math.gl/core';
2
2
  const scratchVector = new Vector3();
3
3
  const scaleToGeodeticSurfaceIntersection = new Vector3();
4
4
  const scaleToGeodeticSurfaceGradient = new Vector3();
5
- export default function scaleToGeodeticSurface(cartesian, ellipsoid, result = []) {
5
+ export function scaleToGeodeticSurface(cartesian, ellipsoid, result = []) {
6
6
  const {
7
7
  oneOverRadii,
8
8
  oneOverRadiiSquared,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ellipsoid/helpers/scale-to-geodetic-surface.ts"],"names":["Vector3","_MathUtils","scratchVector","scaleToGeodeticSurfaceIntersection","scaleToGeodeticSurfaceGradient","scaleToGeodeticSurface","cartesian","ellipsoid","result","oneOverRadii","oneOverRadiiSquared","centerToleranceSquared","from","positionX","x","positionY","y","positionZ","z","oneOverRadiiX","oneOverRadiiY","oneOverRadiiZ","x2","y2","z2","squaredNorm","ratio","Math","sqrt","Number","isFinite","undefined","intersection","copy","scale","to","oneOverRadiiSquaredX","oneOverRadiiSquaredY","oneOverRadiiSquaredZ","gradient","set","lambda","len","correction","xMultiplier","yMultiplier","zMultiplier","func","xMultiplier2","yMultiplier2","zMultiplier2","xMultiplier3","yMultiplier3","zMultiplier3","denominator","derivative","abs","EPSILON12"],"mappings":"AACA,SAAQA,OAAR,EAAiBC,UAAjB,QAAkC,eAAlC;AAGA,MAAMC,aAAa,GAAG,IAAIF,OAAJ,EAAtB;AACA,MAAMG,kCAAkC,GAAG,IAAIH,OAAJ,EAA3C;AACA,MAAMI,8BAA8B,GAAG,IAAIJ,OAAJ,EAAvC;AAKA,eAAe,SAASK,sBAAT,CACbC,SADa,EAEbC,SAFa,EAGbC,MAAgB,GAAG,EAHN,EAIH;AACV,QAAM;AAACC,IAAAA,YAAD;AAAeC,IAAAA,mBAAf;AAAoCC,IAAAA;AAApC,MAA8DJ,SAApE;AAEAL,EAAAA,aAAa,CAACU,IAAd,CAAmBN,SAAnB;AAEA,QAAMO,SAAS,GAAGX,aAAa,C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GA3BD,QA2BS5B,IAAI,CAAC6B,GAAL,CAAST,IAAT,IAAiB9C,UAAU,CAACwD,SA3BrC;;AA6BA,SAAOvD,aAAa,CAACgC,KAAd,CAAoB,CAACU,WAAD,EAAcC,WAAd,EAA2BC,WAA3B,CAApB,EAA6DX,EAA7D,CAAgE3B,MAAhE,CAAP;AACD","sourcesContent":["/* eslint-disable */\nimport {Vector3, _MathUtils} from '@math.gl/core';\nimport type Ellipsoid from '../ellipsoid';\n\nconst scratchVector = new Vector3();\nconst scaleToGeodeticSurfaceIntersection = new Vector3();\nconst scaleToGeodeticSurfaceGradient = new Vector3();\n\n// Scales the provided Cartesian position along the geodetic surface normal\n// so that it is on the surface of this ellipsoid. If the position is\n// at the center of the ellipsoid, this function returns undefined.\nexport default function scaleToGeodeticSurface(\n cartesian: number[],\n ellipsoid: Ellipsoid,\n result: number[] = []\n): number[] {\n const {oneOverRadii, oneOverRadiiSquared, centerToleranceSquared} = ellipsoid;\n\n scratchVector.from(cartesian);\n\n const positionX = scratchVector.x;\n const positionY = scratchVector.y;\n const positionZ = scratchVector.z;\n\n const oneOverRadiiX = oneOverRadii.x;\n const oneOverRadiiY = oneOverRadii.y;\n const oneOverRadiiZ = oneOverRadii.z;\n\n const x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;\n const y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;\n const z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;\n\n // Compute the squared ellipsoid norm.\n const squaredNorm = x2 + y2 + z2;\n const ratio = Math.sqrt(1.0 / squaredNorm);\n\n // When very close to center or at center\n if (!Number.isFinite(ratio)) {\n return undefined;\n }\n\n // As an initial approximation, assume that the radial intersection is the projection point.\n const intersection = scaleToGeodeticSurfaceIntersection;\n intersection.copy(cartesian).scale(ratio);\n\n // If the position is near the center, the iteration will not converge.\n if (squaredNorm < centerToleranceSquared) {\n return intersection.to(result);\n }\n\n const oneOverRadiiSquaredX = oneOverRadiiSquared.x;\n const oneOverRadiiSquaredY = oneOverRadiiSquared.y;\n const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;\n\n // Use the gradient at the intersection point in place of the true unit normal.\n // The difference in magnitude will be absorbed in the multiplier.\n const gradient = scaleToGeodeticSurfaceGradient;\n gradient.set(\n intersection.x * oneOverRadiiSquaredX * 2.0,\n intersection.y * oneOverRadiiSquaredY * 2.0,\n intersection.z * oneOverRadiiSquaredZ * 2.0\n );\n\n // Compute the initial guess at the normal vector multiplier, lambda.\n let lambda = ((1.0 - ratio) * scratchVector.len()) / (0.5 * gradient.len());\n let correction = 0.0;\n\n let xMultiplier;\n let yMultiplier;\n let zMultiplier;\n let func;\n\n do {\n lambda -= correction;\n\n xMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredX);\n yMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredY);\n zMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredZ);\n\n const xMultiplier2 = xMultiplier * xMultiplier;\n const yMultiplier2 = yMultiplier * yMultiplier;\n const zMultiplier2 = zMultiplier * zMultiplier;\n\n const xMultiplier3 = xMultiplier2 * xMultiplier;\n const yMultiplier3 = yMultiplier2 * yMultiplier;\n const zMultiplier3 = zMultiplier2 * zMultiplier;\n\n func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1.0;\n\n // \"denominator\" here refers to the use of this expression in the velocity and acceleration\n // computations in the sections to follow.\n const denominator =\n x2 * xMultiplier3 * oneOverRadiiSquaredX +\n y2 * yMultiplier3 * oneOverRadiiSquaredY +\n z2 * zMultiplier3 * oneOverRadiiSquaredZ;\n\n const derivative = -2.0 * denominator;\n\n correction = func / derivative;\n } while (Math.abs(func) > _MathUtils.EPSILON12);\n\n return scratchVector.scale([xMultiplier, yMultiplier, zMultiplier]).to(result);\n}\n"],"file":"scale-to-geodetic-surface.js"}
1
+ {"version":3,"sources":["../../../src/ellipsoid/helpers/scale-to-geodetic-surface.ts"],"names":["Vector3","_MathUtils","scratchVector","scaleToGeodeticSurfaceIntersection","scaleToGeodeticSurfaceGradient","scaleToGeodeticSurface","cartesian","ellipsoid","result","oneOverRadii","oneOverRadiiSquared","centerToleranceSquared","from","positionX","x","positionY","y","positionZ","z","oneOverRadiiX","oneOverRadiiY","oneOverRadiiZ","x2","y2","z2","squaredNorm","ratio","Math","sqrt","Number","isFinite","undefined","intersection","copy","scale","to","oneOverRadiiSquaredX","oneOverRadiiSquaredY","oneOverRadiiSquaredZ","gradient","set","lambda","len","correction","xMultiplier","yMultiplier","zMultiplier","func","xMultiplier2","yMultiplier2","zMultiplier2","xMultiplier3","yMultiplier3","zMultiplier3","denominator","derivative","abs","EPSILON12"],"mappings":"AACA,SAAQA,OAAR,EAAiBC,UAAjB,QAAkC,eAAlC;AAGA,MAAMC,aAAa,GAAG,IAAIF,OAAJ,EAAtB;AACA,MAAMG,kCAAkC,GAAG,IAAIH,OAAJ,EAA3C;AACA,MAAMI,8BAA8B,GAAG,IAAIJ,OAAJ,EAAvC;AAKA,OAAO,SAASK,sBAAT,CACLC,SADK,EAELC,SAFK,EAGLC,MAAgB,GAAG,EAHd,EAIK;AACV,QAAM;AAACC,IAAAA,YAAD;AAAeC,IAAAA,mBAAf;AAAoCC,IAAAA;AAApC,MAA8DJ,SAApE;AAEAL,EAAAA,aAAa,CAACU,IAAd,CAAmBN,SAAnB;AAEA,QAAMO,SAAS,GAAGX,aAAa,CAACY,CAAhC;AACA,QAAMC,SAAS,GAAGb,aAAa,CAACc,CAAhC;AACA,QAAMC,SAAS,GAAGf,aAAa,CAACgB,CAAhC;AAEA,QAAMC,aAAa,GAAGV,YAAY,CAACK,CAAnC;AACA,QAAMM,aAAa,GAAGX,YAAY,CAACO,CAAnC;AACA,QAAMK,aAAa,GAAGZ,YAAY,CAACS,CAAnC;AAEA,QAAMI,EAAE,GAAGT,SAAS,GAAGA,SAAZ,GAAwBM,aAAxB,GAAwCA,aAAnD;AACA,QAAMI,EAAE,GAAGR,SAAS,GAA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M,IAAIE,UAAV;AAEAC,IAAAA,WAAW,GAAG,OAAO,MAAMH,MAAM,GAAGL,oBAAtB,CAAd;AACAS,IAAAA,WAAW,GAAG,OAAO,MAAMJ,MAAM,GAAGJ,oBAAtB,CAAd;AACAS,IAAAA,WAAW,GAAG,OAAO,MAAML,MAAM,GAAGH,oBAAtB,CAAd;AAEA,UAAMU,YAAY,GAAGJ,WAAW,GAAGA,WAAnC;AACA,UAAMK,YAAY,GAAGJ,WAAW,GAAGA,WAAnC;AACA,UAAMK,YAAY,GAAGJ,WAAW,GAAGA,WAAnC;AAEA,UAAMK,YAAY,GAAGH,YAAY,GAAGJ,WAApC;AACA,UAAMQ,YAAY,GAAGH,YAAY,GAAGJ,WAApC;AACA,UAAMQ,YAAY,GAAGH,YAAY,GAAGJ,WAApC;AAEAC,IAAAA,IAAI,GAAGzB,EAAE,GAAG0B,YAAL,GAAoBzB,EAAE,GAAG0B,YAAzB,GAAwCzB,EAAE,GAAG0B,YAA7C,GAA4D,GAAnE;AAIA,UAAMI,WAAW,GACfhC,EAAE,GAAG6B,YAAL,GAAoBf,oBAApB,GACAb,EAAE,GAAG6B,YAAL,GAAoBf,oBADpB,GAEAb,EAAE,GAAG6B,YAAL,GAAoBf,oBAHtB;AAKA,UAAMiB,UAAU,GAAG,CAAC,GAAD,GAAOD,WAA1B;AAEAX,IAAAA,UAAU,GAAGI,IAAI,GAAGQ,UAApB;AACD,GA3BD,QA2BS5B,IAAI,CAAC6B,GAAL,CAAST,IAAT,IAAiB9C,UAAU,CAACwD,SA3BrC;;AA6BA,SAAOvD,aAAa,CAACgC,KAAd,CAAoB,CAACU,WAAD,EAAcC,WAAd,EAA2BC,WAA3B,CAApB,EAA6DX,EAA7D,CAAgE3B,MAAhE,CAAP;AACD","sourcesContent":["/* eslint-disable */\nimport {Vector3, _MathUtils} from '@math.gl/core';\nimport type {Ellipsoid} from '../ellipsoid';\n\nconst scratchVector = new Vector3();\nconst scaleToGeodeticSurfaceIntersection = new Vector3();\nconst scaleToGeodeticSurfaceGradient = new Vector3();\n\n// Scales the provided Cartesian position along the geodetic surface normal\n// so that it is on the surface of this ellipsoid. If the position is\n// at the center of the ellipsoid, this function returns undefined.\nexport function scaleToGeodeticSurface(\n cartesian: number[],\n ellipsoid: Ellipsoid,\n result: number[] = []\n): number[] {\n const {oneOverRadii, oneOverRadiiSquared, centerToleranceSquared} = ellipsoid;\n\n scratchVector.from(cartesian);\n\n const positionX = scratchVector.x;\n const positionY = scratchVector.y;\n const positionZ = scratchVector.z;\n\n const oneOverRadiiX = oneOverRadii.x;\n const oneOverRadiiY = oneOverRadii.y;\n const oneOverRadiiZ = oneOverRadii.z;\n\n const x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;\n const y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;\n const z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;\n\n // Compute the squared ellipsoid norm.\n const squaredNorm = x2 + y2 + z2;\n const ratio = Math.sqrt(1.0 / squaredNorm);\n\n // When very close to center or at center\n if (!Number.isFinite(ratio)) {\n return undefined;\n }\n\n // As an initial approximation, assume that the radial intersection is the projection point.\n const intersection = scaleToGeodeticSurfaceIntersection;\n intersection.copy(cartesian).scale(ratio);\n\n // If the position is near the center, the iteration will not converge.\n if (squaredNorm < centerToleranceSquared) {\n return intersection.to(result);\n }\n\n const oneOverRadiiSquaredX = oneOverRadiiSquared.x;\n const oneOverRadiiSquaredY = oneOverRadiiSquared.y;\n const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;\n\n // Use the gradient at the intersection point in place of the true unit normal.\n // The difference in magnitude will be absorbed in the multiplier.\n const gradient = scaleToGeodeticSurfaceGradient;\n gradient.set(\n intersection.x * oneOverRadiiSquaredX * 2.0,\n intersection.y * oneOverRadiiSquaredY * 2.0,\n intersection.z * oneOverRadiiSquaredZ * 2.0\n );\n\n // Compute the initial guess at the normal vector multiplier, lambda.\n let lambda = ((1.0 - ratio) * scratchVector.len()) / (0.5 * gradient.len());\n let correction = 0.0;\n\n let xMultiplier;\n let yMultiplier;\n let zMultiplier;\n let func;\n\n do {\n lambda -= correction;\n\n xMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredX);\n yMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredY);\n zMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredZ);\n\n const xMultiplier2 = xMultiplier * xMultiplier;\n const yMultiplier2 = yMultiplier * yMultiplier;\n const zMultiplier2 = zMultiplier * zMultiplier;\n\n const xMultiplier3 = xMultiplier2 * xMultiplier;\n const yMultiplier3 = yMultiplier2 * yMultiplier;\n const zMultiplier3 = zMultiplier2 * zMultiplier;\n\n func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1.0;\n\n // \"denominator\" here refers to the use of this expression in the velocity and acceleration\n // computations in the sections to follow.\n const denominator =\n x2 * xMultiplier3 * oneOverRadiiSquaredX +\n y2 * yMultiplier3 * oneOverRadiiSquaredY +\n z2 * zMultiplier3 * oneOverRadiiSquaredZ;\n\n const derivative = -2.0 * denominator;\n\n correction = func / derivative;\n } while (Math.abs(func) > _MathUtils.EPSILON12);\n\n return scratchVector.scale([xMultiplier, yMultiplier, zMultiplier]).to(result);\n}\n"],"file":"scale-to-geodetic-surface.js"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { default as Ellipsoid } from './ellipsoid/ellipsoid';
1
+ export { Ellipsoid } from './ellipsoid/ellipsoid';
2
2
  export { isWGS84 } from './type-utils';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { default as Ellipsoid } from "./ellipsoid/ellipsoid.js";
1
+ export { Ellipsoid } from "./ellipsoid/ellipsoid.js";
2
2
  export { isWGS84 } from "./type-utils.js";
3
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["default","Ellipsoid","isWGS84"],"mappings":"SAAQA,OAAO,IAAIC,S;SACXC,O","sourcesContent":["export {default as Ellipsoid} from './ellipsoid/ellipsoid';\nexport {isWGS84} from './type-utils';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.ts"],"names":["Ellipsoid","isWGS84"],"mappings":"SAAQA,S;SACAC,O","sourcesContent":["export {Ellipsoid} from './ellipsoid/ellipsoid';\nexport {isWGS84} from './type-utils';\n"],"file":"index.js"}
@@ -1,15 +1,15 @@
1
1
  import type { NumericArray } from '@math.gl/core';
2
- type LngLatHeightObject = {
2
+ declare type LngLatHeightObject = {
3
3
  longitude: number;
4
4
  latitude: number;
5
5
  height: number;
6
6
  };
7
- type XYZObject = {
7
+ declare type XYZObject = {
8
8
  x: number;
9
9
  y: number;
10
10
  z: number;
11
11
  };
12
- type Cartographic = LngLatHeightObject | XYZObject | NumericArray;
12
+ declare type Cartographic = LngLatHeightObject | XYZObject | NumericArray;
13
13
  export declare function fromCartographic(cartographic: Readonly<Cartographic>): number[];
14
14
  export declare function fromCartographic<NumArrayT>(cartographic: Readonly<Cartographic>, result: NumArrayT, map?: (x: number) => number): NumArrayT;
15
15
  export declare function fromCartographicToRadians(cartographic: Readonly<Cartographic>, result?: number[]): number[];
@@ -1 +1 @@
1
- {"version":3,"file":"type-utils.d.ts","sourceRoot":"","sources":["../src/type-utils.ts"],"names":[],"mappings":"AAGA,OAAO,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E,MAAM,EAAE,GAChB,MAAM,EAAE,CAAC;AACZ,wBAAgB,yBAAyB,CAAC,MAAM,EAC9C,YAAY,EAAE,QAAQ,CAAC,YAAY,CAAC,EACpC,MAAM,EAAE,MAAM,GACb,MAAM,CAAC;AAQV,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,QAAQ,CAAC,YAAY,CAAC,EACpC,MAAM,CAAC,EAAE,MAAM,EAAE,GAChB,MAAM,EAAE,CAAC;AACZ,wBAAgB,yBAAyB,CAAC,MAAM,EAC9C,YAAY,EAAE,QAAQ,CAAC,YAAY,CAAC,EACpC,MAAM,EAAE,MAAM,GACb,MAAM,CAAC;AAQV,wBAAgB,cAAc,CAAC,CAAC,SAAS,YAAY,EACnD,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,EAC9B,YAAY,EAAE,CAAC,EACf,GAAG,GAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAiB,GACpC,CAAC,CAeH;AAED,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,YAAY,EAC9D,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,EAC9B,YAAY,EAAE,CAAC,GACd,CAAC,CAEH;AAED,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,YAAY,EAC9D,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,EAC9B,YAAY,EAAE,CAAC,GACd,CAAC,CAEH;AAGD,wBAAgB,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,OAAO,CAU/D"}
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
- "version": "4.0.0-alpha.1",
9
+ "version": "4.0.0-alpha.3",
10
10
  "keywords": [
11
11
  "webgl",
12
12
  "javascript",
@@ -33,8 +33,8 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@babel/runtime": "^7.12.0",
36
- "@math.gl/core": "4.0.0-alpha.1",
36
+ "@math.gl/core": "4.0.0-alpha.3",
37
37
  "gl-matrix": "^3.4.3"
38
38
  },
39
- "gitHead": "66f872ea615a3ef81431595727cdf58dcadf3670"
39
+ "gitHead": "006f278d1b9eb116d8d5731fde8922af6a16e41c"
40
40
  }
@@ -10,8 +10,8 @@ import {WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z} from '../constants';
10
10
  import {fromCartographicToRadians, toCartographicFromRadians} from '../type-utils';
11
11
 
12
12
  import type {AxisDirection} from './helpers/ellipsoid-transform';
13
- import localFrameToFixedFrame from './helpers/ellipsoid-transform';
14
- import scaleToGeodeticSurface from './helpers/scale-to-geodetic-surface';
13
+ import {localFrameToFixedFrame} from './helpers/ellipsoid-transform';
14
+ import {scaleToGeodeticSurface} from './helpers/scale-to-geodetic-surface';
15
15
 
16
16
  const scratchVector = new Vector3();
17
17
  const scratchNormal = new Vector3();
@@ -25,7 +25,7 @@ const scratchCartesian = new Vector3();
25
25
  * `(x / a)^2 + (y / b)^2 + (z / c)^2 = 1`. Primarily used
26
26
  * to represent the shape of planetary bodies.
27
27
  */
28
- export default class Ellipsoid {
28
+ export class Ellipsoid {
29
29
  /** An Ellipsoid instance initialized to the WGS84 standard. */
30
30
  static readonly WGS84: Ellipsoid = new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);
31
31
 
@@ -1,6 +1,6 @@
1
1
  import {NumericArray, Vector3, assert, equals as equalsEpsilon} from '@math.gl/core';
2
2
 
3
- import type Ellipsoid from '../ellipsoid';
3
+ import type {Ellipsoid} from '../ellipsoid';
4
4
 
5
5
  const EPSILON14 = 1e-14;
6
6
 
@@ -76,7 +76,7 @@ const scratchVector3 = new Vector3();
76
76
  // Computes a 4x4 transformation matrix from a reference frame
77
77
  // centered at the provided origin to the provided ellipsoid's fixed reference frame.
78
78
  // eslint-disable-next-line max-statements, max-params, complexity
79
- export default function localFrameToFixedFrame(
79
+ export function localFrameToFixedFrame(
80
80
  ellipsoid: Ellipsoid,
81
81
  firstAxis: AxisDirection,
82
82
  secondAxis: AxisDirection,
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable */
2
2
  import {Vector3, _MathUtils} from '@math.gl/core';
3
- import type Ellipsoid from '../ellipsoid';
3
+ import type {Ellipsoid} from '../ellipsoid';
4
4
 
5
5
  const scratchVector = new Vector3();
6
6
  const scaleToGeodeticSurfaceIntersection = new Vector3();
@@ -9,7 +9,7 @@ const scaleToGeodeticSurfaceGradient = new Vector3();
9
9
  // Scales the provided Cartesian position along the geodetic surface normal
10
10
  // so that it is on the surface of this ellipsoid. If the position is
11
11
  // at the center of the ellipsoid, this function returns undefined.
12
- export default function scaleToGeodeticSurface(
12
+ export function scaleToGeodeticSurface(
13
13
  cartesian: number[],
14
14
  ellipsoid: Ellipsoid,
15
15
  result: number[] = []
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export {default as Ellipsoid} from './ellipsoid/ellipsoid';
1
+ export {Ellipsoid} from './ellipsoid/ellipsoid';
2
2
  export {isWGS84} from './type-utils';