@math.gl/geospatial
Advanced tools
Comparing version 3.0.0-alpha.3 to 3.0.0-alpha.4
@@ -39,12 +39,2 @@ "use strict"; | ||
(0, _createClass2["default"])(Ellipsoid, null, [{ | ||
key: "fromVector3", | ||
value: function fromVector3(_ref) { | ||
var _ref2 = (0, _slicedToArray2["default"])(_ref, 3), | ||
x = _ref2[0], | ||
y = _ref2[1], | ||
z = _ref2[2]; | ||
return new Ellipsoid(x, y, z); | ||
} | ||
}, { | ||
key: "WGS84", | ||
@@ -94,3 +84,3 @@ get: function get() { | ||
value: function cartographicToCartesian(cartographic) { | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new _math.Vector3(); | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
var normal = scratchNormal; | ||
@@ -113,3 +103,3 @@ var k = scratchK; | ||
value: function cartesianToCartographic(cartesian) { | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new _math.Vector3(); | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
var point = this.scaleToGeodeticSurface(cartesian, scratchPosition); | ||
@@ -144,3 +134,4 @@ | ||
value: function geocentricSurfaceNormal(cartesian) { | ||
return scratchVector.from(cartesian).normalize(); | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
return scratchVector.from(cartesian).normalize().to(result); | ||
} | ||
@@ -150,3 +141,3 @@ }, { | ||
value: function geodeticSurfaceNormalCartographic(cartographic) { | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new _math.Vector3(); | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
var cartographicVectorRadians = (0, _typeUtils.fromCartographicToRadians)(cartographic); | ||
@@ -162,3 +153,3 @@ var longitude = cartographicVectorRadians[0]; | ||
value: function geodeticSurfaceNormal(cartesian) { | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new _math.Vector3(); | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
return scratchVector.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result); | ||
@@ -174,3 +165,3 @@ } | ||
value: function scaleToGeocentricSurface(cartesian) { | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new _math.Vector3(); | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
scratchPosition.from(cartesian); | ||
@@ -187,3 +178,3 @@ var positionX = scratchPosition.x; | ||
value: function transformPositionToScaledSpace(position) { | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new _math.Vector3(); | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
return scratchPosition.from(position).scale(this.oneOverRadii).to(result); | ||
@@ -194,3 +185,3 @@ } | ||
value: function transformPositionFromScaledSpace(position) { | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new _math.Vector3(); | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
return scratchPosition.from(position).scale(this.radii).to(result); | ||
@@ -202,3 +193,3 @@ } | ||
var buffer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.0; | ||
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new _math.Vector3(); | ||
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [0, 0, 0]; | ||
(0, _math.assert)((0, _math.equals)(this.radii.x, this.radii.y, _math._MathUtils.EPSILON15)); | ||
@@ -205,0 +196,0 @@ (0, _math.assert)(this.radii.z > 0); |
@@ -19,7 +19,2 @@ import { Vector3, Matrix4, toRadians, toDegrees, assert, equals, _MathUtils } from 'math.gl'; | ||
static fromVector3(_ref) { | ||
let [x, y, z] = _ref; | ||
return new Ellipsoid(x, y, z); | ||
} | ||
constructor() { | ||
@@ -57,3 +52,3 @@ let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.0; | ||
cartographicToCartesian(cartographic) { | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(); | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
const normal = scratchNormal; | ||
@@ -72,3 +67,3 @@ const k = scratchK; | ||
cartesianToCartographic(cartesian) { | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(); | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
const point = this.scaleToGeodeticSurface(cartesian, scratchPosition); | ||
@@ -100,7 +95,8 @@ | ||
geocentricSurfaceNormal(cartesian) { | ||
return scratchVector.from(cartesian).normalize(); | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
return scratchVector.from(cartesian).normalize().to(result); | ||
} | ||
geodeticSurfaceNormalCartographic(cartographic) { | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(); | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
const cartographicVectorRadians = fromCartographicToRadians(cartographic); | ||
@@ -115,3 +111,3 @@ const longitude = cartographicVectorRadians[0]; | ||
geodeticSurfaceNormal(cartesian) { | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(); | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
return scratchVector.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result); | ||
@@ -125,3 +121,3 @@ } | ||
scaleToGeocentricSurface(cartesian) { | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(); | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
scratchPosition.from(cartesian); | ||
@@ -137,3 +133,3 @@ const positionX = scratchPosition.x; | ||
transformPositionToScaledSpace(position) { | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(); | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
return scratchPosition.from(position).scale(this.oneOverRadii).to(result); | ||
@@ -143,3 +139,3 @@ } | ||
transformPositionFromScaledSpace(position) { | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(); | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
return scratchPosition.from(position).scale(this.radii).to(result); | ||
@@ -150,3 +146,3 @@ } | ||
let buffer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.0; | ||
let result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Vector3(); | ||
let result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [0, 0, 0]; | ||
assert(equals(this.radii.x, this.radii.y, _MathUtils.EPSILON15)); | ||
@@ -153,0 +149,0 @@ assert(this.radii.z > 0); |
@@ -19,12 +19,2 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
_createClass(Ellipsoid, null, [{ | ||
key: "fromVector3", | ||
value: function fromVector3(_ref) { | ||
var _ref2 = _slicedToArray(_ref, 3), | ||
x = _ref2[0], | ||
y = _ref2[1], | ||
z = _ref2[2]; | ||
return new Ellipsoid(x, y, z); | ||
} | ||
}, { | ||
key: "WGS84", | ||
@@ -76,3 +66,3 @@ get: function get() { | ||
value: function cartographicToCartesian(cartographic) { | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(); | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
var normal = scratchNormal; | ||
@@ -95,3 +85,3 @@ var k = scratchK; | ||
value: function cartesianToCartographic(cartesian) { | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(); | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
var point = this.scaleToGeodeticSurface(cartesian, scratchPosition); | ||
@@ -126,3 +116,4 @@ | ||
value: function geocentricSurfaceNormal(cartesian) { | ||
return scratchVector.from(cartesian).normalize(); | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
return scratchVector.from(cartesian).normalize().to(result); | ||
} | ||
@@ -132,3 +123,3 @@ }, { | ||
value: function geodeticSurfaceNormalCartographic(cartographic) { | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(); | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
var cartographicVectorRadians = fromCartographicToRadians(cartographic); | ||
@@ -144,3 +135,3 @@ var longitude = cartographicVectorRadians[0]; | ||
value: function geodeticSurfaceNormal(cartesian) { | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(); | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
return scratchVector.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result); | ||
@@ -156,3 +147,3 @@ } | ||
value: function scaleToGeocentricSurface(cartesian) { | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(); | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
scratchPosition.from(cartesian); | ||
@@ -169,3 +160,3 @@ var positionX = scratchPosition.x; | ||
value: function transformPositionToScaledSpace(position) { | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(); | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
return scratchPosition.from(position).scale(this.oneOverRadii).to(result); | ||
@@ -176,3 +167,3 @@ } | ||
value: function transformPositionFromScaledSpace(position) { | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(); | ||
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
return scratchPosition.from(position).scale(this.radii).to(result); | ||
@@ -184,3 +175,3 @@ } | ||
var buffer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.0; | ||
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Vector3(); | ||
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [0, 0, 0]; | ||
assert(equals(this.radii.x, this.radii.y, _MathUtils.EPSILON15)); | ||
@@ -187,0 +178,0 @@ assert(this.radii.z > 0); |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "3.0.0-alpha.3", | ||
"version": "3.0.0-alpha.4", | ||
"keywords": [ | ||
@@ -37,5 +37,5 @@ "webgl", | ||
"gl-matrix": "^3.0.0", | ||
"math.gl": "3.0.0-alpha.3" | ||
"math.gl": "3.0.0-alpha.4" | ||
}, | ||
"gitHead": "1294046057e49eeb197023cf86bb100fb49382d5" | ||
"gitHead": "90158f9659da040d75517b7f07c169fd0d015577" | ||
} |
@@ -32,7 +32,3 @@ // This file is derived from the Cesium math library under Apache 2 license | ||
// Computes an Ellipsoid from a Cartesian specifying the radii in x, y, and z directions. | ||
static fromVector3([x, y, z]) { | ||
return new Ellipsoid(x, y, z); | ||
} | ||
// Creates an Ellipsoid from a Cartesian specifying the radii in x, y, and z directions. | ||
constructor(x = 0.0, y = 0.0, z = 0.0) { | ||
@@ -85,3 +81,3 @@ assert(x >= 0.0); | ||
// Converts the provided cartographic to Cartesian representation. | ||
cartographicToCartesian(cartographic, result = new Vector3()) { | ||
cartographicToCartesian(cartographic, result = [0, 0, 0]) { | ||
const normal = scratchNormal; | ||
@@ -106,3 +102,3 @@ const k = scratchK; | ||
// The cartesian is undefined at the center of the ellipsoid. | ||
cartesianToCartographic(cartesian, result = new Vector3()) { | ||
cartesianToCartographic(cartesian, result = [0, 0, 0]) { | ||
const point = this.scaleToGeodeticSurface(cartesian, scratchPosition); | ||
@@ -140,8 +136,11 @@ | ||
// the provided Cartesian position. | ||
geocentricSurfaceNormal(cartesian) { | ||
return scratchVector.from(cartesian).normalize(); | ||
geocentricSurfaceNormal(cartesian, result = [0, 0, 0]) { | ||
return scratchVector | ||
.from(cartesian) | ||
.normalize() | ||
.to(result); | ||
} | ||
// Computes the normal of the plane tangent to the surface of the ellipsoid at provided position. | ||
geodeticSurfaceNormalCartographic(cartographic, result = new Vector3()) { | ||
geodeticSurfaceNormalCartographic(cartographic, result = [0, 0, 0]) { | ||
const cartographicVectorRadians = fromCartographicToRadians(cartographic); | ||
@@ -162,3 +161,3 @@ | ||
// Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position. | ||
geodeticSurfaceNormal(cartesian, result = new Vector3()) { | ||
geodeticSurfaceNormal(cartesian, result = [0, 0, 0]) { | ||
return scratchVector | ||
@@ -180,3 +179,3 @@ .from(cartesian) | ||
// so that it is on the surface of this ellipsoid. | ||
scaleToGeocentricSurface(cartesian, result = new Vector3()) { | ||
scaleToGeocentricSurface(cartesian, result = [0, 0, 0]) { | ||
scratchPosition.from(cartesian); | ||
@@ -202,3 +201,3 @@ | ||
// its components by the result of `Ellipsoid#oneOverRadii` | ||
transformPositionToScaledSpace(position, result = new Vector3()) { | ||
transformPositionToScaledSpace(position, result = [0, 0, 0]) { | ||
return scratchPosition | ||
@@ -212,3 +211,3 @@ .from(position) | ||
// its components by the result of `Ellipsoid#radii`. | ||
transformPositionFromScaledSpace(position, result = new Vector3()) { | ||
transformPositionFromScaledSpace(position, result = [0, 0, 0]) { | ||
return scratchPosition | ||
@@ -221,3 +220,3 @@ .from(position) | ||
// Computes a point which is the intersection of the surface normal with the z-axis. | ||
getSurfaceNormalIntersectionWithZAxis(position, buffer = 0.0, result = new Vector3()) { | ||
getSurfaceNormalIntersectionWithZAxis(position, buffer = 0.0, result = [0, 0, 0]) { | ||
// Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y) | ||
@@ -224,0 +223,0 @@ assert(equals(this.radii.x, this.radii.y, _MathUtils.EPSILON15)); |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
193239
1687
1
+ Addedmath.gl@3.0.0-alpha.4(transitive)
- Removedmath.gl@3.0.0-alpha.3(transitive)
Updatedmath.gl@3.0.0-alpha.4