Socket
Socket
Sign inDemoInstall

@math.gl/geospatial

Package Overview
Dependencies
Maintainers
3
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@math.gl/geospatial - npm Package Compare versions

Comparing version 3.5.6 to 3.6.0-alpha.1

dist/constants.d.ts

8

dist/es5/constants.js

@@ -7,9 +7,9 @@ "use strict";

exports.WGS84_CONSTANTS = exports.WGS84_RADIUS_Z = exports.WGS84_RADIUS_Y = exports.WGS84_RADIUS_X = void 0;
var WGS84_RADIUS_X = 6378137.0;
const WGS84_RADIUS_X = 6378137.0;
exports.WGS84_RADIUS_X = WGS84_RADIUS_X;
var WGS84_RADIUS_Y = 6378137.0;
const WGS84_RADIUS_Y = 6378137.0;
exports.WGS84_RADIUS_Y = WGS84_RADIUS_Y;
var WGS84_RADIUS_Z = 6356752.3142451793;
const WGS84_RADIUS_Z = 6356752.3142451793;
exports.WGS84_RADIUS_Z = WGS84_RADIUS_Z;
var WGS84_CONSTANTS = {
const WGS84_CONSTANTS = {
radii: [WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z],

@@ -16,0 +16,0 @@ radiiSquared: [WGS84_RADIUS_X * WGS84_RADIUS_X, WGS84_RADIUS_Y * WGS84_RADIUS_Y, WGS84_RADIUS_Z * WGS84_RADIUS_Z],

@@ -5,4 +5,2 @@ "use strict";

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {

@@ -13,8 +11,4 @@ value: true

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _core = require("@math.gl/core");

@@ -28,24 +22,29 @@

var _scaleToGeodeticSurface2 = _interopRequireDefault(require("./helpers/scale-to-geodetic-surface"));
var _scaleToGeodeticSurface = _interopRequireDefault(require("./helpers/scale-to-geodetic-surface"));
var _ellipsoidTransform = _interopRequireDefault(require("./helpers/ellipsoid-transform"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var scratchVector = new _core.Vector3();
var scratchNormal = new _core.Vector3();
var scratchK = new _core.Vector3();
var scratchPosition = new _core.Vector3();
var scratchHeight = new _core.Vector3();
var scratchCartesian = new _core.Vector3();
var wgs84;
const scratchVector = new _core.Vector3();
const scratchNormal = new _core.Vector3();
const scratchK = new _core.Vector3();
const scratchPosition = new _core.Vector3();
const scratchHeight = new _core.Vector3();
const scratchCartesian = new _core.Vector3();
let wgs84;
var Ellipsoid = function () {
function Ellipsoid() {
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.0;
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.0;
var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.0;
(0, _classCallCheck2.default)(this, Ellipsoid);
class Ellipsoid {
constructor(x = 0.0, y = 0.0, z = 0.0) {
(0, _defineProperty2.default)(this, "radii", void 0);
(0, _defineProperty2.default)(this, "radiiSquared", void 0);
(0, _defineProperty2.default)(this, "radiiToTheFourth", void 0);
(0, _defineProperty2.default)(this, "oneOverRadii", void 0);
(0, _defineProperty2.default)(this, "oneOverRadiiSquared", void 0);
(0, _defineProperty2.default)(this, "minimumRadius", void 0);
(0, _defineProperty2.default)(this, "maximumRadius", void 0);
(0, _defineProperty2.default)(this, "centerToleranceSquared", _core._MathUtils.EPSILON1);
(0, _defineProperty2.default)(this, "squaredXOverSquaredZ", void 0);
(0, _core.assert)(x >= 0.0);

@@ -61,3 +60,2 @@ (0, _core.assert)(y >= 0.0);

this.maximumRadius = Math.max(x, y, z);
this.centerToleranceSquared = _core._MathUtils.EPSILON1;

@@ -71,140 +69,104 @@ if (this.radiiSquared.z !== 0) {

(0, _createClass2.default)(Ellipsoid, [{
key: "equals",
value: function equals(right) {
return this === right || Boolean(right && this.radii.equals(right.radii));
}
}, {
key: "toString",
value: function toString() {
return this.radii.toString();
}
}, {
key: "cartographicToCartesian",
value: function cartographicToCartesian(cartographic) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
var normal = scratchNormal;
var k = scratchK;
equals(right) {
return this === right || Boolean(right && this.radii.equals(right.radii));
}
var _cartographic = (0, _slicedToArray2.default)(cartographic, 3),
height = _cartographic[2];
toString() {
return this.radii.toString();
}
this.geodeticSurfaceNormalCartographic(cartographic, normal);
k.copy(this.radiiSquared).scale(normal);
var gamma = Math.sqrt(normal.dot(k));
k.scale(1 / gamma);
normal.scale(height);
k.add(normal);
return k.to(result);
}
}, {
key: "cartesianToCartographic",
value: function cartesianToCartographic(cartesian) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
scratchCartesian.from(cartesian);
var point = this.scaleToGeodeticSurface(scratchCartesian, scratchPosition);
cartographicToCartesian(cartographic, result = [0, 0, 0]) {
const normal = scratchNormal;
const k = scratchK;
const [,, height] = cartographic;
this.geodeticSurfaceNormalCartographic(cartographic, normal);
k.copy(this.radiiSquared).scale(normal);
const gamma = Math.sqrt(normal.dot(k));
k.scale(1 / gamma);
normal.scale(height);
k.add(normal);
return k.to(result);
}
if (!point) {
return undefined;
}
cartesianToCartographic(cartesian, result = [0, 0, 0]) {
scratchCartesian.from(cartesian);
const point = this.scaleToGeodeticSurface(scratchCartesian, scratchPosition);
var normal = this.geodeticSurfaceNormal(point, scratchNormal);
var h = scratchHeight;
h.copy(scratchCartesian).subtract(point);
var longitude = Math.atan2(normal.y, normal.x);
var latitude = Math.asin(normal.z);
var height = Math.sign(vec3.dot(h, scratchCartesian)) * vec3.length(h);
return (0, _typeUtils.toCartographicFromRadians)([longitude, latitude, height], result);
if (!point) {
return undefined;
}
}, {
key: "eastNorthUpToFixedFrame",
value: function eastNorthUpToFixedFrame(origin) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new _core.Matrix4();
return (0, _ellipsoidTransform.default)(this, 'east', 'north', 'up', origin, result);
}
}, {
key: "localFrameToFixedFrame",
value: function localFrameToFixedFrame(firstAxis, secondAxis, thirdAxis, origin) {
var result = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : new _core.Matrix4();
return (0, _ellipsoidTransform.default)(this, firstAxis, secondAxis, thirdAxis, origin, result);
}
}, {
key: "geocentricSurfaceNormal",
value: function geocentricSurfaceNormal(cartesian) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
return scratchVector.from(cartesian).normalize().to(result);
}
}, {
key: "geodeticSurfaceNormalCartographic",
value: function geodeticSurfaceNormalCartographic(cartographic) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
var cartographicVectorRadians = (0, _typeUtils.fromCartographicToRadians)(cartographic);
var longitude = cartographicVectorRadians[0];
var latitude = cartographicVectorRadians[1];
var cosLatitude = Math.cos(latitude);
scratchVector.set(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), Math.sin(latitude)).normalize();
return scratchVector.to(result);
}
}, {
key: "geodeticSurfaceNormal",
value: function geodeticSurfaceNormal(cartesian) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
return scratchVector.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);
}
}, {
key: "scaleToGeodeticSurface",
value: function scaleToGeodeticSurface(cartesian, result) {
return (0, _scaleToGeodeticSurface2.default)(cartesian, this, result);
}
}, {
key: "scaleToGeocentricSurface",
value: function scaleToGeocentricSurface(cartesian) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
scratchPosition.from(cartesian);
var positionX = scratchPosition.x;
var positionY = scratchPosition.y;
var positionZ = scratchPosition.z;
var oneOverRadiiSquared = this.oneOverRadiiSquared;
var beta = 1.0 / Math.sqrt(positionX * positionX * oneOverRadiiSquared.x + positionY * positionY * oneOverRadiiSquared.y + positionZ * positionZ * oneOverRadiiSquared.z);
return scratchPosition.multiplyScalar(beta).to(result);
}
}, {
key: "transformPositionToScaledSpace",
value: function transformPositionToScaledSpace(position) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
return scratchPosition.from(position).scale(this.oneOverRadii).to(result);
}
}, {
key: "transformPositionFromScaledSpace",
value: function transformPositionFromScaledSpace(position) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
return scratchPosition.from(position).scale(this.radii).to(result);
}
}, {
key: "getSurfaceNormalIntersectionWithZAxis",
value: function getSurfaceNormalIntersectionWithZAxis(position) {
var buffer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.0;
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [0, 0, 0];
(0, _core.assert)((0, _core.equals)(this.radii.x, this.radii.y, _core._MathUtils.EPSILON15));
(0, _core.assert)(this.radii.z > 0);
scratchPosition.from(position);
var z = scratchPosition.z * (1 - this.squaredXOverSquaredZ);
if (Math.abs(z) >= this.radii.z - buffer) {
return undefined;
}
const normal = this.geodeticSurfaceNormal(point, scratchNormal);
const h = scratchHeight;
h.copy(scratchCartesian).subtract(point);
const longitude = Math.atan2(normal.y, normal.x);
const latitude = Math.asin(normal.z);
const height = Math.sign(vec3.dot(h, scratchCartesian)) * vec3.length(h);
return (0, _typeUtils.toCartographicFromRadians)([longitude, latitude, height], result);
}
return scratchPosition.set(0.0, 0.0, z).to(result);
eastNorthUpToFixedFrame(origin, result = new _core.Matrix4()) {
return (0, _ellipsoidTransform.default)(this, 'east', 'north', 'up', origin, result);
}
localFrameToFixedFrame(firstAxis, secondAxis, thirdAxis, origin, result = new _core.Matrix4()) {
return (0, _ellipsoidTransform.default)(this, firstAxis, secondAxis, thirdAxis, origin, result);
}
geocentricSurfaceNormal(cartesian, result = [0, 0, 0]) {
return scratchVector.from(cartesian).normalize().to(result);
}
geodeticSurfaceNormalCartographic(cartographic, result = [0, 0, 0]) {
const cartographicVectorRadians = (0, _typeUtils.fromCartographicToRadians)(cartographic);
const longitude = cartographicVectorRadians[0];
const latitude = cartographicVectorRadians[1];
const cosLatitude = Math.cos(latitude);
scratchVector.set(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), Math.sin(latitude)).normalize();
return scratchVector.to(result);
}
geodeticSurfaceNormal(cartesian, result = [0, 0, 0]) {
return scratchVector.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);
}
scaleToGeodeticSurface(cartesian, result) {
return (0, _scaleToGeodeticSurface.default)(cartesian, this, result);
}
scaleToGeocentricSurface(cartesian, result = [0, 0, 0]) {
scratchPosition.from(cartesian);
const positionX = scratchPosition.x;
const positionY = scratchPosition.y;
const positionZ = scratchPosition.z;
const oneOverRadiiSquared = this.oneOverRadiiSquared;
const beta = 1.0 / Math.sqrt(positionX * positionX * oneOverRadiiSquared.x + positionY * positionY * oneOverRadiiSquared.y + positionZ * positionZ * oneOverRadiiSquared.z);
return scratchPosition.multiplyScalar(beta).to(result);
}
transformPositionToScaledSpace(position, result = [0, 0, 0]) {
return scratchPosition.from(position).scale(this.oneOverRadii).to(result);
}
transformPositionFromScaledSpace(position, result = [0, 0, 0]) {
return scratchPosition.from(position).scale(this.radii).to(result);
}
getSurfaceNormalIntersectionWithZAxis(position, buffer = 0.0, result = [0, 0, 0]) {
(0, _core.assert)((0, _core.equals)(this.radii.x, this.radii.y, _core._MathUtils.EPSILON15));
(0, _core.assert)(this.radii.z > 0);
scratchPosition.from(position);
const z = scratchPosition.z * (1 - this.squaredXOverSquaredZ);
if (Math.abs(z) >= this.radii.z - buffer) {
return undefined;
}
}], [{
key: "WGS84",
get: function get() {
wgs84 = wgs84 || new Ellipsoid(_constants.WGS84_RADIUS_X, _constants.WGS84_RADIUS_Y, _constants.WGS84_RADIUS_Z);
return wgs84;
}
}]);
return Ellipsoid;
}();
return scratchPosition.set(0.0, 0.0, z).to(result);
}
}
exports.default = Ellipsoid;
(0, _defineProperty2.default)(Ellipsoid, "WGS84", new Ellipsoid(_constants.WGS84_RADIUS_X, _constants.WGS84_RADIUS_Y, _constants.WGS84_RADIUS_Z));
//# sourceMappingURL=ellipsoid.js.map

@@ -10,5 +10,5 @@ "use strict";

var EPSILON14 = 1e-14;
var scratchOrigin = new _core.Vector3();
var VECTOR_PRODUCT_LOCAL_FRAME = {
const EPSILON14 = 1e-14;
const scratchOrigin = new _core.Vector3();
const VECTOR_PRODUCT_LOCAL_FRAME = {
up: {

@@ -51,3 +51,3 @@ south: 'east',

};
var degeneratePositionLocalFrame = {
const degeneratePositionLocalFrame = {
north: [-1, 0, 0],

@@ -60,3 +60,3 @@ east: [0, 1, 0],

};
var scratchAxisVectors = {
const scratchAxisVectors = {
east: new _core.Vector3(),

@@ -69,17 +69,17 @@ north: new _core.Vector3(),

};
var scratchVector1 = new _core.Vector3();
var scratchVector2 = new _core.Vector3();
var scratchVector3 = new _core.Vector3();
const scratchVector1 = new _core.Vector3();
const scratchVector2 = new _core.Vector3();
const scratchVector3 = new _core.Vector3();
function localFrameToFixedFrame(ellipsoid, firstAxis, secondAxis, thirdAxis, cartesianOrigin, result) {
var thirdAxisInferred = VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] && VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis];
const thirdAxisInferred = VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] && VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis];
(0, _core.assert)(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));
var firstAxisVector;
var secondAxisVector;
var thirdAxisVector;
var origin = scratchOrigin.copy(cartesianOrigin);
var atPole = (0, _core.equals)(origin.x, 0.0, EPSILON14) && (0, _core.equals)(origin.y, 0.0, EPSILON14);
let firstAxisVector;
let secondAxisVector;
let thirdAxisVector;
const origin = scratchOrigin.copy(cartesianOrigin);
const atPole = (0, _core.equals)(origin.x, 0.0, EPSILON14) && (0, _core.equals)(origin.y, 0.0, EPSILON14);
if (atPole) {
var sign = Math.sign(origin.z);
const sign = Math.sign(origin.z);
firstAxisVector = scratchVector1.fromArray(degeneratePositionLocalFrame[firstAxis]);

@@ -103,11 +103,15 @@

} else {
var up = scratchAxisVectors.up,
east = scratchAxisVectors.east,
north = scratchAxisVectors.north;
const {
up,
east,
north
} = scratchAxisVectors;
east.set(-origin.y, origin.x, 0.0).normalize();
ellipsoid.geodeticSurfaceNormal(origin, up);
north.copy(up).cross(east);
var down = scratchAxisVectors.down,
west = scratchAxisVectors.west,
south = scratchAxisVectors.south;
const {
down,
west,
south
} = scratchAxisVectors;
down.copy(up).scale(-1);

@@ -114,0 +118,0 @@ west.copy(east).scale(-1);

"use strict";
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {

@@ -12,29 +10,24 @@ value: true

var vec3 = _interopRequireWildcard(require("gl-matrix/vec3"));
const scratchVector = new _core.Vector3();
const scaleToGeodeticSurfaceIntersection = new _core.Vector3();
const scaleToGeodeticSurfaceGradient = new _core.Vector3();
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var scratchVector = new _core.Vector3();
var scaleToGeodeticSurfaceIntersection = new _core.Vector3();
var scaleToGeodeticSurfaceGradient = new _core.Vector3();
function scaleToGeodeticSurface(cartesian, ellipsoid) {
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new _core.Vector3();
var oneOverRadii = ellipsoid.oneOverRadii,
oneOverRadiiSquared = ellipsoid.oneOverRadiiSquared,
centerToleranceSquared = ellipsoid.centerToleranceSquared;
function scaleToGeodeticSurface(cartesian, ellipsoid, result = new _core.Vector3()) {
const {
oneOverRadii,
oneOverRadiiSquared,
centerToleranceSquared
} = ellipsoid;
scratchVector.from(cartesian);
var positionX = cartesian.x;
var positionY = cartesian.y;
var positionZ = cartesian.z;
var oneOverRadiiX = oneOverRadii.x;
var oneOverRadiiY = oneOverRadii.y;
var oneOverRadiiZ = oneOverRadii.z;
var x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;
var y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;
var z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;
var squaredNorm = x2 + y2 + z2;
var ratio = Math.sqrt(1.0 / squaredNorm);
const positionX = cartesian.x;
const positionY = cartesian.y;
const positionZ = cartesian.z;
const oneOverRadiiX = oneOverRadii.x;
const oneOverRadiiY = oneOverRadii.y;
const oneOverRadiiZ = oneOverRadii.z;
const x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;
const y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;
const z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;
const squaredNorm = x2 + y2 + z2;
const ratio = Math.sqrt(1.0 / squaredNorm);

@@ -45,3 +38,3 @@ if (!Number.isFinite(ratio)) {

var intersection = scaleToGeodeticSurfaceIntersection;
const intersection = scaleToGeodeticSurfaceIntersection;
intersection.copy(cartesian).scale(ratio);

@@ -53,13 +46,13 @@

var oneOverRadiiSquaredX = oneOverRadiiSquared.x;
var oneOverRadiiSquaredY = oneOverRadiiSquared.y;
var oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
var gradient = scaleToGeodeticSurfaceGradient;
const oneOverRadiiSquaredX = oneOverRadiiSquared.x;
const oneOverRadiiSquaredY = oneOverRadiiSquared.y;
const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
const gradient = scaleToGeodeticSurfaceGradient;
gradient.set(intersection.x * oneOverRadiiSquaredX * 2.0, intersection.y * oneOverRadiiSquaredY * 2.0, intersection.z * oneOverRadiiSquaredZ * 2.0);
var lambda = (1.0 - ratio) * cartesian.len() / (0.5 * gradient.len());
var correction = 0.0;
var xMultiplier;
var yMultiplier;
var zMultiplier;
var func;
let lambda = (1.0 - ratio) * cartesian.len() / (0.5 * gradient.len());
let correction = 0.0;
let xMultiplier;
let yMultiplier;
let zMultiplier;
let func;

@@ -71,11 +64,11 @@ do {

zMultiplier = 1.0 / (1.0 + lambda * oneOverRadiiSquaredZ);
var xMultiplier2 = xMultiplier * xMultiplier;
var yMultiplier2 = yMultiplier * yMultiplier;
var zMultiplier2 = zMultiplier * zMultiplier;
var xMultiplier3 = xMultiplier2 * xMultiplier;
var yMultiplier3 = yMultiplier2 * yMultiplier;
var zMultiplier3 = zMultiplier2 * zMultiplier;
const xMultiplier2 = xMultiplier * xMultiplier;
const yMultiplier2 = yMultiplier * yMultiplier;
const zMultiplier2 = zMultiplier * zMultiplier;
const xMultiplier3 = xMultiplier2 * xMultiplier;
const yMultiplier3 = yMultiplier2 * yMultiplier;
const zMultiplier3 = zMultiplier2 * zMultiplier;
func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1.0;
var denominator = x2 * xMultiplier3 * oneOverRadiiSquaredX + y2 * yMultiplier3 * oneOverRadiiSquaredY + z2 * zMultiplier3 * oneOverRadiiSquaredZ;
var derivative = -2.0 * denominator;
const denominator = x2 * xMultiplier3 * oneOverRadiiSquaredX + y2 * yMultiplier3 * oneOverRadiiSquaredY + z2 * zMultiplier3 * oneOverRadiiSquaredZ;
const derivative = -2.0 * denominator;
correction = func / derivative;

@@ -82,0 +75,0 @@ } while (Math.abs(func) > _core._MathUtils.EPSILON12);

@@ -10,3 +10,3 @@ "use strict";

enumerable: true,
get: function get() {
get: function () {
return _ellipsoid.default;

@@ -17,3 +17,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _typeUtils.isWGS84;

@@ -20,0 +20,0 @@ }

@@ -18,11 +18,7 @@ "use strict";

var noop = function noop(x) {
return x;
};
const noop = x => x;
var scratchVector = new _core.Vector3();
const scratchVector = new _core.Vector3();
function fromCartographic(cartographic, result) {
var map = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop;
function fromCartographic(cartographic, result = [-0, -0, -0], map = noop) {
if ((0, _core.isArray)(cartographic)) {

@@ -45,15 +41,11 @@ result[0] = map(cartographic[0]);

function fromCartographicToRadians(cartographic) {
var vector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scratchVector;
function fromCartographicToRadians(cartographic, vector = []) {
return fromCartographic(cartographic, vector, _core.config._cartographicRadians ? noop : _core.toRadians);
}
function fromCartographicToDegrees(cartographic) {
var vector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scratchVector;
function fromCartographicToDegrees(cartographic, vector = []) {
return fromCartographic(cartographic, vector, _core.config._cartographicRadians ? _core.toDegrees : noop);
}
function toCartographic(vector, cartographic) {
var map = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop;
function toCartographic(vector, cartographic, map = noop) {
if ((0, _core.isArray)(cartographic)) {

@@ -90,9 +82,11 @@ cartographic[0] = map(vector[0]);

scratchVector.from(vector);
var oneOverRadiiSquared = _constants.WGS84_CONSTANTS.oneOverRadiiSquared,
centerToleranceSquared = _constants.WGS84_CONSTANTS.centerToleranceSquared;
var x2 = vector[0] * vector[0] * oneOverRadiiSquared[0];
var y2 = vector[1] * vector[1] * oneOverRadiiSquared[1];
var z2 = vector[2] * vector[2] * oneOverRadiiSquared[2];
const {
oneOverRadiiSquared,
centerToleranceSquared
} = _constants.WGS84_CONSTANTS;
const x2 = vector[0] * vector[0] * oneOverRadiiSquared[0];
const y2 = vector[1] * vector[1] * oneOverRadiiSquared[1];
const z2 = vector[2] * vector[2] * oneOverRadiiSquared[2];
return Math.abs(x2 + y2 + z2 - 1) < centerToleranceSquared;
}
//# sourceMappingURL=type-utils.js.map

@@ -1,2 +0,3 @@

import { Vector3, Matrix4, toRadians, toDegrees, assert, equals, _MathUtils } from '@math.gl/core';
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Vector3, Matrix4, assert, equals, _MathUtils } from '@math.gl/core';
import * as vec3 from 'gl-matrix/vec3';

@@ -15,8 +16,21 @@ import { WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z } from '../constants';

export default class Ellipsoid {
static get WGS84() {
wgs84 = wgs84 || new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);
return wgs84;
}
constructor(x = 0.0, y = 0.0, z = 0.0) {
_defineProperty(this, "radii", void 0);
constructor(x = 0.0, y = 0.0, z = 0.0) {
_defineProperty(this, "radiiSquared", void 0);
_defineProperty(this, "radiiToTheFourth", void 0);
_defineProperty(this, "oneOverRadii", void 0);
_defineProperty(this, "oneOverRadiiSquared", void 0);
_defineProperty(this, "minimumRadius", void 0);
_defineProperty(this, "maximumRadius", void 0);
_defineProperty(this, "centerToleranceSquared", _MathUtils.EPSILON1);
_defineProperty(this, "squaredXOverSquaredZ", void 0);
assert(x >= 0.0);

@@ -32,3 +46,2 @@ assert(y >= 0.0);

this.maximumRadius = Math.max(x, y, z);
this.centerToleranceSquared = _MathUtils.EPSILON1;

@@ -141,2 +154,4 @@ if (this.radiiSquared.z !== 0) {

}
_defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
//# sourceMappingURL=ellipsoid.js.map

@@ -1,3 +0,2 @@

import { Vector3, assert, _MathUtils } from '@math.gl/core';
import * as vec3 from 'gl-matrix/vec3';
import { Vector3, _MathUtils } from '@math.gl/core';
const scratchVector = new Vector3();

@@ -4,0 +3,0 @@ const scaleToGeodeticSurfaceIntersection = new Vector3();

@@ -7,3 +7,3 @@ import { Vector3, isArray, toRadians, toDegrees, config } from '@math.gl/core';

const scratchVector = new Vector3();
export function fromCartographic(cartographic, result, map = noop) {
export function fromCartographic(cartographic, result = [-0, -0, -0], map = noop) {
if (isArray(cartographic)) {

@@ -25,6 +25,6 @@ result[0] = map(cartographic[0]);

}
export function fromCartographicToRadians(cartographic, vector = scratchVector) {
export function fromCartographicToRadians(cartographic, vector = []) {
return fromCartographic(cartographic, vector, config._cartographicRadians ? noop : toRadians);
}
export function fromCartographicToDegrees(cartographic, vector = scratchVector) {
export function fromCartographicToDegrees(cartographic, vector = []) {
return fromCartographic(cartographic, vector, config._cartographicRadians ? toDegrees : noop);

@@ -31,0 +31,0 @@ }

@@ -8,3 +8,3 @@ {

},
"version": "3.5.6",
"version": "3.6.0-alpha.1",
"keywords": [

@@ -27,3 +27,3 @@ "webgl",

},
"types": "src/index.js",
"types": "dist/index.d.ts",
"main": "dist/es5/index.js",

@@ -37,6 +37,6 @@ "module": "dist/esm/index.js",

"@babel/runtime": "^7.12.0",
"@math.gl/core": "3.5.6",
"@math.gl/core": "3.6.0-alpha.1",
"gl-matrix": "~3.3.0"
},
"gitHead": "0e69c70ff2e6373fed84d303cbf8198a6972944f"
"gitHead": "45386981340895bf201c2ebb76257c9bbffd8ff6"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc