Socket
Socket
Sign inDemoInstall

@loaders.gl/math

Package Overview
Dependencies
Maintainers
9
Versions
310
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/math - npm Package Compare versions

Comparing version 1.2.0-beta.2 to 1.2.0-beta.3

10

dist/es5/geometry/constants.js

@@ -10,4 +10,8 @@ "use strict";

var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var GL_PRIMITIVE = {

@@ -40,4 +44,6 @@ POINTS: 0x0000,

exports.GL_TYPE = GL_TYPE;
var GL = (0, _objectSpread2["default"])({}, GL_PRIMITIVE_MODE, GL_TYPE);
var GL = _objectSpread({}, GL_PRIMITIVE_MODE, {}, GL_TYPE);
exports.GL = GL;
//# sourceMappingURL=constants.js.map

16

dist/es6/geometry/attributes/compute-bounding-box.js
export function computeBoundingBox(positions) {
let target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Box3();
const min = [+Infinity, +Infinity, +Infinity];
const max = [-Infinity, -Infinity, -Infinity];
var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Box3();
var min = [+Infinity, +Infinity, +Infinity];
var max = [-Infinity, -Infinity, -Infinity];
for (const position of attributeIterator(positions)) {
const x = position[0];
const y = position[1];
const z = position[2];
for (var position of attributeIterator(positions)) {
var x = position[0];
var y = position[1];
var z = position[2];
if (x < min[0]) min[0] = x;

@@ -18,3 +18,3 @@ if (y < min[1]) min[1] = y;

const boundingBox = {
var boundingBox = {
min,

@@ -21,0 +21,0 @@ max

import { Vector3 } from 'math.gl';
import { getPositions } from './get-attribute-from-geometry';
export function computeBoundingSphere(geometry, boundingBox) {
const positions = getPositions(geometry);
const center = getBoundingBox(center);
var positions = getPositions(geometry);
var center = getBoundingBox(center);
box.setFromBufferAttribute(position);

@@ -10,10 +10,10 @@ box.getCenter(center);

for (const position of attributeIterator(positions)) {
vector.x = position[0];
vector.y = position[1];
vector.z = position[2];
for (var _position of attributeIterator(positions)) {
vector.x = _position[0];
vector.y = _position[1];
vector.z = _position[2];
maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(vector));
}
const radius = Math.sqrt(maxRadiusSq);
var radius = Math.sqrt(maxRadiusSq);
assert(Number.isFinite(radius));

@@ -20,0 +20,0 @@ return {

@@ -8,3 +8,3 @@ import { Vector3 } from 'math.gl';

export default function computeVertexNormals(_ref) {
let {
var {
mode,

@@ -15,3 +15,3 @@ indices,

assert(getPrimitiveModeType(mode) === GL.TRIANGLES, 'TRIANGLES required');
const {
var {
values: positions

@@ -23,10 +23,10 @@ } = getPositions({

});
const normals = new Float32Array(positions.length);
const vectorA = new Vector3();
const vectorB = new Vector3();
const vectorC = new Vector3();
const vectorCB = new Vector3();
const vectorAB = new Vector3();
var normals = new Float32Array(positions.length);
var vectorA = new Vector3();
var vectorB = new Vector3();
var vectorC = new Vector3();
var vectorCB = new Vector3();
var vectorAB = new Vector3();
for (const primitive of primitiveIterator({
for (var primitive of primitiveIterator({
mode,

@@ -41,5 +41,5 @@ indices,

vectorAB.subVectors(vectorA, vectorB);
const normal = vectorCB.cross(vectorAB);
var normal = vectorCB.cross(vectorAB);
normal.normalize();
const {
var {
primitiveIndex

@@ -46,0 +46,0 @@ } = primitive;

export function convertBuffersToNonIndexed(_ref) {
let {
var {
indices,
attributes
} = _ref;
const geometry2 = new BufferGeometry();
var geometry2 = new BufferGeometry();
for (const name in attributes) {
const attribute = attributes[name];
const array = attribute.array;
const itemSize = attribute.itemSize;
const array2 = new array.constructor(indices.length * itemSize);
let index = 0,
for (var name in attributes) {
var attribute = attributes[name];
var array = attribute.array;
var itemSize = attribute.itemSize;
var array2 = new array.constructor(indices.length * itemSize);
var index = 0,
index2 = 0;

@@ -15,0 +15,0 @@

@@ -5,6 +5,6 @@ import isGeometry from '../is-geometry';

if (isGeometry(geometry)) {
const {
var {
attributes
} = geometry;
const position = attributes.POSITION || attributes.positions;
var position = attributes.POSITION || attributes.positions;
assert(position);

@@ -11,0 +11,0 @@ return position;

@@ -1,3 +0,8 @@

import _objectSpread from "@babel/runtime/helpers/esm/objectSpread";
export const GL_PRIMITIVE = {
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
export var GL_PRIMITIVE = {
POINTS: 0x0000,

@@ -7,3 +12,3 @@ LINES: 0x0001,

};
export const GL_PRIMITIVE_MODE = {
export var GL_PRIMITIVE_MODE = {
POINTS: 0x0000,

@@ -17,3 +22,3 @@ LINES: 0x0001,

};
export const GL_TYPE = {
export var GL_TYPE = {
BYTE: 5120,

@@ -28,3 +33,3 @@ UNSIGNED_BYTE: 5121,

};
export const GL = _objectSpread({}, GL_PRIMITIVE_MODE, GL_TYPE);
export var GL = _objectSpread({}, GL_PRIMITIVE_MODE, {}, GL_TYPE);
//# sourceMappingURL=constants.js.map
import { GL_TYPE as GL } from '../constants';
const GL_TYPE_TO_ARRAY_TYPE = {
var GL_TYPE_TO_ARRAY_TYPE = {
[GL.DOUBLE]: Float64Array,

@@ -12,3 +12,3 @@ [GL.FLOAT]: Float32Array,

};
const NAME_TO_GL_TYPE = {
var NAME_TO_GL_TYPE = {
DOUBLE: GL.DOUBLE,

@@ -23,3 +23,3 @@ FLOAT: GL.FLOAT,

};
const ERR_TYPE_CONVERSION = 'Failed to convert GL type';
var ERR_TYPE_CONVERSION = 'Failed to convert GL type';
export default class GLType {

@@ -29,4 +29,4 @@ static fromTypedArray(arrayOrType) {

for (const glType in GL_TYPE_TO_ARRAY_TYPE) {
const ArrayType = GL_TYPE_TO_ARRAY_TYPE[glType];
for (var glType in GL_TYPE_TO_ARRAY_TYPE) {
var ArrayType = GL_TYPE_TO_ARRAY_TYPE[glType];

@@ -42,3 +42,3 @@ if (ArrayType === arrayOrType) {

static fromName(name) {
const glType = NAME_TO_GL_TYPE[name];
var glType = NAME_TO_GL_TYPE[name];

@@ -53,3 +53,3 @@ if (!glType) {

static getArrayType(glType) {
let clamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var clamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

@@ -63,3 +63,3 @@ switch (glType) {

default:
const ArrayType = GL_TYPE_TO_ARRAY_TYPE[glType];
var ArrayType = GL_TYPE_TO_ARRAY_TYPE[glType];

@@ -75,3 +75,3 @@ if (!ArrayType) {

static getByteSize(glType) {
const ArrayType = GLType.getArrayType(glType);
var ArrayType = GLType.getArrayType(glType);
return ArrayType.BYTES_PER_ELEMENT;

@@ -85,4 +85,4 @@ }

static createTypedArray(glType, buffer) {
let byteOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
let length = arguments.length > 3 ? arguments[3] : undefined;
var byteOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
var length = arguments.length > 3 ? arguments[3] : undefined;

@@ -93,3 +93,3 @@ if (length === undefined) {

const ArrayType = GLType.getArrayType(glType);
var ArrayType = GLType.getArrayType(glType);
return new ArrayType(buffer, byteOffset, length);

@@ -96,0 +96,0 @@ }

export default function* attributeIterator(_ref) {
let {
var {
values,
size
} = _ref;
const ArrayType = values.constructor;
const element = new ArrayType(size);
var ArrayType = values.constructor;
var element = new ArrayType(size);
for (let i = 0; i < values.length; i += size) {
for (let j = 0; j < size; j++) {
for (var i = 0; i < values.length; i += size) {
for (var j = 0; j < size; j++) {
element[j] = element[i + j];

@@ -12,0 +12,0 @@ }

@@ -5,3 +5,3 @@ import { GL } from '../constants';

export default function* primitiveIterator(_ref) {
let {
var {
indices,

@@ -24,7 +24,7 @@ attributes,

const info = {
var info = {
attributes,
type: getPrimitiveModeType(mode)
};
let i = start;
var i = start;

@@ -31,0 +31,0 @@ while (i < end) {

export function concatTypedArrays(arrays) {
let byteLength = 0;
var byteLength = 0;
for (let i = 0; i < arrays.length; ++i) {
for (var i = 0; i < arrays.length; ++i) {
byteLength += arrays[i].byteLength;
}
const buffer = new Uint8Array(byteLength);
let byteOffset = 0;
var buffer = new Uint8Array(byteLength);
var byteOffset = 0;
for (let i = 0; i < arrays.length; ++i) {
const data = new Uint8Array(arrays[i].buffer);
for (var _i = 0; _i < arrays.length; ++_i) {
var data = new Uint8Array(arrays[_i].buffer);
byteLength = data.length;
for (let j = 0; j < byteLength; ++j) {
for (var j = 0; j < byteLength; ++j) {
buffer[byteOffset++] = data[j];

@@ -17,0 +17,0 @@ }

@@ -1,2 +0,7 @@

import _objectSpread from "@babel/runtime/helpers/esm/objectSpread";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
export var GL_PRIMITIVE = {

@@ -26,3 +31,3 @@ POINTS: 0x0000,

};
export var GL = _objectSpread({}, GL_PRIMITIVE_MODE, GL_TYPE);
export var GL = _objectSpread({}, GL_PRIMITIVE_MODE, {}, GL_TYPE);
//# sourceMappingURL=constants.js.map
{
"name": "@loaders.gl/math",
"version": "1.2.0-beta.2",
"version": "1.2.0-beta.3",
"description": "Experimental math classes for loaders.gl",

@@ -34,6 +34,6 @@ "license": "MIT",

"dependencies": {
"@loaders.gl/core": "1.2.0-beta.2",
"@loaders.gl/images": "1.2.0-beta.2"
"@loaders.gl/core": "1.2.0-beta.3",
"@loaders.gl/images": "1.2.0-beta.3"
},
"gitHead": "82626f4ecad7c816c70780376d661f267b6c523e"
"gitHead": "39442622efe0e06323db958c53c9805fc9b7699d"
}

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