@loaders.gl/math
Advanced tools
Comparing version 1.1.0-beta.1 to 1.1.0
@@ -84,6 +84,7 @@ import Vector3 from '../vector3'; | ||
setFromArray(_ref) { | ||
let array = _ref.array, | ||
elements = _ref.elements, | ||
_ref$size = _ref.size, | ||
size = _ref$size === void 0 ? 3 : _ref$size; | ||
let { | ||
array, | ||
elements, | ||
size = 3 | ||
} = _ref; | ||
const length = elements !== undefined ? elements * size : array.length; | ||
@@ -90,0 +91,0 @@ let minX = Number.MAX_VALUE; |
@@ -8,14 +8,15 @@ import { Vector3 } from 'math.gl'; | ||
export default function computeVertexNormals(_ref) { | ||
let mode = _ref.mode, | ||
indices = _ref.indices, | ||
attributes = _ref.attributes; | ||
let { | ||
mode, | ||
indices, | ||
attributes | ||
} = _ref; | ||
assert(getPrimitiveModeType(mode) === GL.TRIANGLES, 'TRIANGLES required'); | ||
const _getPositions = getPositions({ | ||
const { | ||
values: positions | ||
} = getPositions({ | ||
mode, | ||
indices, | ||
attributes | ||
}), | ||
positions = _getPositions.values; | ||
}); | ||
const normals = new Float32Array(positions.length); | ||
@@ -40,3 +41,5 @@ const vectorA = new Vector3(); | ||
normal.normalize(); | ||
const primitiveIndex = primitive.primitiveIndex; | ||
const { | ||
primitiveIndex | ||
} = primitive; | ||
normals[primitiveIndex * 9 + 0] = normal.x; | ||
@@ -43,0 +46,0 @@ normals[primitiveIndex * 9 + 1] = normal.y; |
export function convertBuffersToNonIndexed(_ref) { | ||
let indices = _ref.indices, | ||
attributes = _ref.attributes; | ||
let { | ||
indices, | ||
attributes | ||
} = _ref; | ||
const geometry2 = new BufferGeometry(); | ||
@@ -5,0 +7,0 @@ |
@@ -5,3 +5,5 @@ import isGeometry from '../is-geometry'; | ||
if (isGeometry(geometry)) { | ||
const attributes = geometry.attributes; | ||
const { | ||
attributes | ||
} = geometry; | ||
const position = attributes.POSITION || attributes.positions; | ||
@@ -8,0 +10,0 @@ assert(position); |
export default function* attributeIterator(_ref) { | ||
let values = _ref.values, | ||
size = _ref.size; | ||
let { | ||
values, | ||
size | ||
} = _ref; | ||
const ArrayType = values.constructor; | ||
@@ -5,0 +7,0 @@ const element = new ArrayType(size); |
@@ -5,8 +5,9 @@ import { GL } from '../constants'; | ||
export default function* primitiveIterator(_ref) { | ||
let indices = _ref.indices, | ||
attributes = _ref.attributes, | ||
mode = _ref.mode, | ||
_ref$start = _ref.start, | ||
start = _ref$start === void 0 ? 0 : _ref$start, | ||
end = _ref.end; | ||
let { | ||
indices, | ||
attributes, | ||
mode, | ||
start = 0, | ||
end | ||
} = _ref; | ||
@@ -13,0 +14,0 @@ if (indices) { |
@@ -1,2 +0,1 @@ | ||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import { Vector3, degrees as toDegrees, radians as toRadians } from 'math.gl'; | ||
@@ -37,8 +36,3 @@ import assert from '../utils/assert'; | ||
static toRadians(_ref) { | ||
let _ref2 = _slicedToArray(_ref, 3), | ||
longitude = _ref2[0], | ||
latitude = _ref2[1], | ||
_ref2$ = _ref2[2], | ||
z = _ref2$ === void 0 ? 0 : _ref2$; | ||
let [longitude, latitude, z = 0] = _ref; | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
@@ -53,9 +47,4 @@ assert(Number.isFinite(longitude)); | ||
static toDegrees(_ref3) { | ||
let _ref4 = _slicedToArray(_ref3, 3), | ||
longitude = _ref4[0], | ||
latitude = _ref4[1], | ||
_ref4$ = _ref4[2], | ||
z = _ref4$ === void 0 ? 0 : _ref4$; | ||
static toDegrees(_ref2) { | ||
let [longitude, latitude, z = 0] = _ref2; | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0]; | ||
@@ -69,15 +58,9 @@ assert(Number.isFinite(longitude)); | ||
static toCartesian(_ref5, ellipsoid, result) { | ||
let _ref6 = _slicedToArray(_ref5, 3), | ||
longitude = _ref6[0], | ||
latitude = _ref6[1], | ||
_ref6$ = _ref6[2], | ||
z = _ref6$ === void 0 ? 0 : _ref6$; | ||
static toCartesian(_ref3, ellipsoid, result) { | ||
let [longitude, latitude, z = 0] = _ref3; | ||
assert(Number.isFinite(longitude)); | ||
assert(Number.isFinite(latitude)); | ||
const _getEllipsoidProperti = getEllipsoidProperties(ellipsoid), | ||
radiiSquared = _getEllipsoidProperti.radiiSquared; | ||
const { | ||
radiiSquared | ||
} = getEllipsoidProperties(ellipsoid); | ||
const cosLatitude = Math.cos(latitude); | ||
@@ -98,8 +81,7 @@ scratchN.x = cosLatitude * Math.cos(longitude); | ||
let result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [0, 0, 0]; | ||
const _getEllipsoidFields = getEllipsoidFields(ellipsoid), | ||
oneOverRadii = _getEllipsoidFields.oneOverRadii, | ||
oneOverRadiiSquared = _getEllipsoidFields.oneOverRadiiSquared, | ||
centerToleranceSquared = _getEllipsoidFields.centerToleranceSquared; | ||
const { | ||
oneOverRadii, | ||
oneOverRadiiSquared, | ||
centerToleranceSquared | ||
} = getEllipsoidFields(ellipsoid); | ||
const p = scaleToGeodeticSurface(cartesian, oneOverRadii, oneOverRadiiSquared, centerToleranceSquared, cartesianToCartographicP); | ||
@@ -106,0 +88,0 @@ |
@@ -1,2 +0,1 @@ | ||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import { Vector3, radians as toRadians, degrees as toDegrees } from 'math.gl'; | ||
@@ -62,7 +61,3 @@ import * as vec3 from 'gl-matrix/vec3'; | ||
static fromVector3(_ref) { | ||
let _ref2 = _slicedToArray(_ref, 3), | ||
x = _ref2[0], | ||
y = _ref2[1], | ||
z = _ref2[2]; | ||
let [x, y, z] = _ref; | ||
return new Ellipsoid(x, y, z); | ||
@@ -138,6 +133,3 @@ } | ||
let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(); | ||
const _cartographic = _slicedToArray(cartographic, 3), | ||
height = _cartographic[2]; | ||
const [,, height] = cartographic; | ||
var normal = cartographicToCartesianNormal; | ||
@@ -144,0 +136,0 @@ var k = cartographicToCartesianK; |
@@ -9,5 +9,7 @@ import { Vector3 } from 'math.gl'; | ||
let result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Vector3(); | ||
const oneOverRadii = ellipsoid.oneOverRadii, | ||
oneOverRadiiSquared = ellipsoid.oneOverRadiiSquared, | ||
centerToleranceSquared = ellipsoid.centerToleranceSquared; | ||
const { | ||
oneOverRadii, | ||
oneOverRadiiSquared, | ||
centerToleranceSquared | ||
} = ellipsoid; | ||
assert(Number.isFinite(cartesian.x)); | ||
@@ -14,0 +16,0 @@ assert(Number.isFinite(cartesian.y)); |
{ | ||
"name": "@loaders.gl/math", | ||
"version": "1.1.0-beta.1", | ||
"version": "1.1.0", | ||
"description": "Experimental math classes for loaders.gl", | ||
@@ -34,5 +34,6 @@ "license": "MIT", | ||
"dependencies": { | ||
"@loaders.gl/core": "1.1.0-beta.1", | ||
"@loaders.gl/images": "1.1.0-beta.1" | ||
} | ||
"@loaders.gl/core": "1.1.0", | ||
"@loaders.gl/images": "1.1.0" | ||
}, | ||
"gitHead": "3e703baf6d39bbefce19a509709f5dc80a1cc428" | ||
} |
# @loaders.gl/math (Experimental, Temporary) | ||
[loaders.gl](https://uber-web.github.io/loaders.gl/#/docs) is a collection of framework independent 3D and geospatial parsers and encoders. | ||
[loaders.gl](https://loaders.gl/docs) is a collection of framework independent 3D and geospatial parsers and encoders. | ||
@@ -5,0 +5,0 @@ This module contains math utilities for the `@loaders.gl3d-tiles` module. As they mature, these will likely be moved to a math framework (e.g. math.gl). |
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1657988
311
1
2
80
15637
+ Added@loaders.gl/core@1.1.0(transitive)
+ Added@loaders.gl/images@1.1.0(transitive)
- Removed@loaders.gl/core@1.1.0-beta.1(transitive)
- Removed@loaders.gl/images@1.1.0-beta.1(transitive)
Updated@loaders.gl/core@1.1.0
Updated@loaders.gl/images@1.1.0