@math.gl/core
Advanced tools
Comparing version 3.6.3 to 4.0.0-alpha.1
@@ -8,3 +8,3 @@ import { NumericArray } from '@math.gl/types'; | ||
abstract copy(vector: Readonly<NumericArray>): this; | ||
abstract fromObject(object: object): this; | ||
abstract fromObject(object: Record<string, unknown>): this; | ||
/** | ||
@@ -18,4 +18,4 @@ * Clone the current object | ||
toArray(targetArray?: number[], offset?: number): NumericArray; | ||
from(arrayOrObject: Readonly<NumericArray> | object): this; | ||
to<T extends NumericArray | object>(arrayOrObject: T): T; | ||
from(arrayOrObject: Readonly<NumericArray> | Record<string, unknown>): this; | ||
to<T extends NumericArray | Record<string, unknown>>(arrayOrObject: T): T; | ||
toTarget(target: this): this; | ||
@@ -22,0 +22,0 @@ /** @deprecated */ |
@@ -33,3 +33,3 @@ import MathArray from './base/math-array'; | ||
fromQuaternion(quaternion: Readonly<NumericArray>): this; | ||
fromObject(object: object): this; | ||
fromObject(object: Record<string, unknown>): this; | ||
copy(array: Readonly<NumericArray>): this; | ||
@@ -36,0 +36,0 @@ set(x: number, y: number, z: number, order: RotationOrder): this; |
@@ -0,3 +1,3 @@ | ||
import { NumericArray } from '@math.gl/types'; | ||
import Matrix from './base/matrix'; | ||
import { NumericArray } from '@math.gl/types'; | ||
declare enum INDICES { | ||
@@ -4,0 +4,0 @@ COL0ROW0 = 0, |
@@ -0,3 +1,3 @@ | ||
import { NumericArray } from '@math.gl/types'; | ||
import Matrix from './base/matrix'; | ||
import { NumericArray } from '@math.gl/types'; | ||
declare enum INDICES { | ||
@@ -4,0 +4,0 @@ COL0ROW0 = 0, |
@@ -5,3 +5,3 @@ import Matrix4 from './matrix4'; | ||
import { NumericArray } from '@math.gl/types'; | ||
declare type PoseOptions = { | ||
type PoseOptions = { | ||
position?: Readonly<NumericArray>; | ||
@@ -8,0 +8,0 @@ orientation?: Readonly<NumericArray>; |
@@ -0,3 +1,3 @@ | ||
import { NumericArray } from '@math.gl/types'; | ||
import MathArray from './base/math-array'; | ||
import { NumericArray } from '@math.gl/types'; | ||
export default class Quaternion extends MathArray { | ||
@@ -4,0 +4,0 @@ constructor(x?: number | Readonly<NumericArray>, y?: number, z?: number, w?: number); |
@@ -0,4 +1,4 @@ | ||
import { NumericArray } from '@math.gl/types'; | ||
import Vector3 from './vector3'; | ||
import { NumericArray } from '@math.gl/types'; | ||
declare type SphericalCoordinatesOptions = { | ||
type SphericalCoordinatesOptions = { | ||
phi?: number; | ||
@@ -12,3 +12,3 @@ theta?: number; | ||
}; | ||
declare type FormatOptions = { | ||
type FormatOptions = { | ||
printTypes?: boolean; | ||
@@ -15,0 +15,0 @@ }; |
@@ -0,3 +1,3 @@ | ||
import { NumericArray } from '@math.gl/types'; | ||
import Vector from './base/vector'; | ||
import { NumericArray } from '@math.gl/types'; | ||
import type Matrix4 from './matrix4'; | ||
@@ -4,0 +4,0 @@ /** |
import { NumericArray } from '@math.gl/types'; | ||
import type MathArray from '../classes/base/math-array'; | ||
export declare type ConfigurationOptions = { | ||
export type ConfigurationOptions = { | ||
EPSILON: number; | ||
@@ -5,0 +5,0 @@ debug?: boolean; |
import { NumberArray } from '@math.gl/types'; | ||
export declare function validateVector(v: NumberArray, length: number): boolean; | ||
export declare function checkNumber(value: any): number; | ||
export declare function checkNumber(value: unknown): number; | ||
export declare function checkVector<T extends NumberArray>(v: T, length: number, callerName?: string): T; | ||
export declare function deprecated(method: string, version: string): void; | ||
//# sourceMappingURL=validators.d.ts.map |
@@ -5,6 +5,7 @@ { | ||
"license": "MIT", | ||
"type": "module", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"version": "3.6.3", | ||
"version": "4.0.0-alpha.1", | ||
"keywords": [ | ||
@@ -31,4 +32,4 @@ "webgl", | ||
"types": "dist/index.d.ts", | ||
"main": "dist/es5/index.js", | ||
"module": "dist/esm/index.js", | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.js", | ||
"files": [ | ||
@@ -43,6 +44,6 @@ "dist", | ||
"@babel/runtime": "^7.12.0", | ||
"@math.gl/types": "3.6.3", | ||
"gl-matrix": "^3.4.0" | ||
"@math.gl/types": "4.0.0-alpha.1", | ||
"gl-matrix": "^3.4.3" | ||
}, | ||
"gitHead": "0efab394df9babad7ed93027c1003f30528b2090" | ||
"gitHead": "66f872ea615a3ef81431595727cdf58dcadf3670" | ||
} |
@@ -12,3 +12,3 @@ // math.gl, MIT License | ||
abstract fromObject(object: object): this; | ||
abstract fromObject(object: Record<string, unknown>): this; | ||
@@ -43,7 +43,10 @@ // Common methods | ||
from(arrayOrObject: Readonly<NumericArray> | object): this { | ||
return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject); | ||
from(arrayOrObject: Readonly<NumericArray> | Record<string, unknown>): this { | ||
return Array.isArray(arrayOrObject) | ||
? this.copy(arrayOrObject) | ||
: // @ts-ignore | ||
this.fromObject(arrayOrObject); | ||
} | ||
to<T extends NumericArray | object>(arrayOrObject: T): T { | ||
to<T extends NumericArray | Record<string, unknown>>(arrayOrObject: T): T { | ||
// @ts-ignore | ||
@@ -66,3 +69,3 @@ if (arrayOrObject === this) { | ||
toString(): string { | ||
override toString(): string { | ||
return this.formatString(config); | ||
@@ -124,3 +127,4 @@ } | ||
const ai = a[i]; | ||
this[i] = ai + t * (b[i] - ai); | ||
const endValue = typeof b === 'number' ? b : b[i]; | ||
this[i] = ai + t * (endValue - ai); | ||
} | ||
@@ -127,0 +131,0 @@ return this.check(); |
@@ -23,3 +23,3 @@ // Copyright (c) 2017 Uber Technologies, Inc. | ||
// TODO better override formatString? | ||
toString(): string { | ||
override toString(): string { | ||
let string = '['; | ||
@@ -26,0 +26,0 @@ if (config.printRowMajor) { |
@@ -151,4 +151,4 @@ // Copyright (c) 2017 Uber Technologies, Inc. | ||
// @ts-expect-error error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. | ||
return this.add(new this.constructor(a).multiplyScalar(b)); | ||
return this.add((new this.constructor(a) as this).multiplyScalar(b)); | ||
} | ||
} |
@@ -95,3 +95,3 @@ // Copyright (c) 2017 Uber Technologies, Inc. | ||
fromObject(object: object): this { | ||
fromObject(object: Record<string, unknown>): this { | ||
throw new Error('not implemented'); | ||
@@ -125,3 +125,3 @@ // return this.set(object.x, object.y, object.z, object.order); | ||
validate(): boolean { | ||
override validate(): boolean { | ||
return ( | ||
@@ -136,3 +136,3 @@ validateOrder(this[3]) && | ||
// Does not copy the orientation element | ||
toArray(array: NumericArray = [], offset: number = 0): NumericArray { | ||
override toArray(array: NumericArray = [], offset: number = 0): NumericArray { | ||
array[offset] = this[0]; | ||
@@ -262,3 +262,3 @@ array[offset + 1] = this[1]; | ||
// TODO - with and without 4th element | ||
fromArray(array: Readonly<NumericArray>, offset: number = 0): this { | ||
override fromArray(array: Readonly<NumericArray>, offset: number = 0): this { | ||
this[0] = array[0 + offset]; | ||
@@ -265,0 +265,0 @@ this[1] = array[1 + offset]; |
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// MIT License | ||
import {NumericArray} from '@math.gl/types'; | ||
import Matrix from './base/matrix'; | ||
@@ -7,6 +9,8 @@ import {checkVector} from '../lib/validators'; | ||
import {vec4_transformMat3} from '../lib/gl-matrix-extras'; | ||
// @ts-ignore gl-matrix types... | ||
import * as mat3 from 'gl-matrix/mat3'; | ||
// @ts-ignore gl-matrix types... | ||
import * as vec2 from 'gl-matrix/vec2'; | ||
// @ts-ignore gl-matrix types... | ||
import * as vec3 from 'gl-matrix/vec3'; | ||
import {NumericArray} from '@math.gl/types'; | ||
@@ -188,3 +192,3 @@ enum INDICES { | ||
scale(factor: NumericArray | number): this { | ||
override scale(factor: NumericArray | number): this { | ||
if (Array.isArray(factor)) { | ||
@@ -239,4 +243,4 @@ mat3.scale(this, this, factor); | ||
let ZERO_MATRIX3; | ||
let IDENTITY_MATRIX3; | ||
let ZERO_MATRIX3: Matrix3 | null; | ||
let IDENTITY_MATRIX3: Matrix3 | null = null; | ||
@@ -243,0 +247,0 @@ function getZeroMatrix(): Readonly<Matrix3> { |
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// MIT License | ||
import {NumericArray} from '@math.gl/types'; | ||
import Matrix from './base/matrix'; | ||
import {NumericArray} from '@math.gl/types'; | ||
import {checkVector} from '../lib/validators'; | ||
@@ -9,5 +10,9 @@ | ||
import {vec2_transformMat4AsVector, vec3_transformMat4AsVector} from '../lib/gl-matrix-extras'; | ||
// @ts-ignore gl-matrix types... | ||
import * as mat4 from 'gl-matrix/mat4'; | ||
// @ts-ignore gl-matrix types... | ||
import * as vec2 from 'gl-matrix/vec2'; | ||
// @ts-ignore gl-matrix types... | ||
import * as vec3 from 'gl-matrix/vec3'; | ||
// @ts-ignore gl-matrix types... | ||
import * as vec4 from 'gl-matrix/vec4'; | ||
@@ -507,3 +512,3 @@ | ||
*/ | ||
scale(factor: number | Readonly<NumericArray>): this { | ||
override scale(factor: number | Readonly<NumericArray>): this { | ||
mat4.scale(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]); | ||
@@ -510,0 +515,0 @@ return this.check(); |
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// MIT License | ||
import {NumericArray} from '@math.gl/types'; | ||
import MathArray from './base/math-array'; | ||
import {checkNumber, checkVector} from '../lib/validators'; | ||
import Vector4 from './vector4'; | ||
// @ts-ignore gl-matrix types... | ||
import * as quat from 'gl-matrix/quat'; | ||
// @ts-ignore gl-matrix types... | ||
import * as vec4 from 'gl-matrix/vec4'; | ||
import {NumericArray} from '@math.gl/types'; | ||
@@ -163,3 +165,3 @@ const IDENTITY_QUATERNION = [0, 0, 0, 1] as const; | ||
// Adds two quat's | ||
add(a: Readonly<NumericArray>): this { | ||
override add(a: Readonly<NumericArray>): this { | ||
quat.add(this, this, a); | ||
@@ -190,3 +192,3 @@ return this.check(); | ||
// Performs a linear interpolation between two quat's | ||
lerp(a: Readonly<NumericArray>, b: Readonly<NumericArray> | number, t?: number): this { | ||
override lerp(a: Readonly<NumericArray>, b: Readonly<NumericArray> | number, t?: number): this { | ||
if (t === undefined) { | ||
@@ -245,3 +247,3 @@ return this.lerp(this, a, b as number); | ||
// Scales a quat by a scalar number | ||
scale(b: number): this { | ||
override scale(b: number): this { | ||
quat.scale(this, this, b); | ||
@@ -248,0 +250,0 @@ return this.check(); |
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// MIT License | ||
// Adaptation of THREE.js Spherical class, under MIT license | ||
import {NumericArray} from '@math.gl/types'; | ||
import Vector3 from './vector3'; | ||
import {formatValue, equals, config} from '../lib/common'; | ||
import {degrees, radians, clamp} from '../lib/common'; | ||
// @ts-ignore gl-matrix types... | ||
import * as vec3 from 'gl-matrix/vec3'; | ||
import {NumericArray} from '@math.gl/types'; | ||
@@ -10,0 +11,0 @@ type SphericalCoordinatesOptions = { |
@@ -6,2 +6,3 @@ // Copyright (c) 2017 Uber Technologies, Inc. | ||
import {checkNumber} from '../lib/validators'; | ||
// @ts-ignore gl-matrix types... | ||
import * as vec2 from 'gl-matrix/vec2'; | ||
@@ -8,0 +9,0 @@ /* eslint-disable camelcase */ |
@@ -7,2 +7,3 @@ // Copyright (c) 2017 Uber Technologies, Inc. | ||
import {checkNumber} from '../lib/validators'; | ||
// @ts-ignore gl-matrix types | ||
import * as vec3 from 'gl-matrix/vec3'; | ||
@@ -9,0 +10,0 @@ /* eslint-disable camelcase */ |
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// MIT License | ||
import Vector from './base/vector'; | ||
import {config, isArray} from '../lib/common'; | ||
import {checkNumber} from '../lib/validators'; | ||
import {NumericArray} from '@math.gl/types'; | ||
// @ts-ignore gl-matrix types... | ||
import * as vec4 from 'gl-matrix/vec3'; | ||
/* eslint-disable camelcase */ | ||
import {vec4_transformMat2, vec4_transformMat3} from '../lib/gl-matrix-extras'; | ||
import {NumericArray} from '@math.gl/types'; | ||
import Vector from './base/vector'; | ||
import {config, isArray} from '../lib/common'; | ||
import {checkNumber} from '../lib/validators'; | ||
import type Matrix4 from './matrix4'; | ||
@@ -13,0 +15,0 @@ |
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// MIT License | ||
import {NumericArray} from '@math.gl/types'; | ||
import assert from './assert'; | ||
@@ -32,7 +31,3 @@ import type MathArray from '../classes/base/math-array'; | ||
export function configure(options?: Partial<ConfigurationOptions>): ConfigurationOptions { | ||
// Only copy existing keys | ||
for (const key in options) { | ||
assert(key in config); | ||
config[key] = options[key]; | ||
} | ||
Object.assign(config, options); | ||
return config; | ||
@@ -299,3 +294,4 @@ } | ||
for (let i = 0; i < result.length && i < array.length; ++i) { | ||
result[i] = func(value[i], i, result); | ||
const val = typeof value === 'number' ? value : value[i]; | ||
result[i] = func(val, i, result); | ||
} | ||
@@ -302,0 +298,0 @@ return result; |
@@ -36,3 +36,3 @@ // Copyright (c) 2017 Uber Technologies, Inc. | ||
export function checkNumber(value: any): number { | ||
export function checkNumber(value: unknown): number { | ||
if (!Number.isFinite(value)) { | ||
@@ -55,3 +55,3 @@ throw new Error(`Invalid number ${value}`); | ||
const map = {}; | ||
const map: Record<string, boolean> = {}; | ||
@@ -58,0 +58,0 @@ export function deprecated(method: string, version: string): void { |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
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
Yes
480813
336960
99
9111
2
1
+ Added@math.gl/types@4.0.0-alpha.1(transitive)
- Removed@math.gl/types@3.6.3(transitive)
Updated@math.gl/types@4.0.0-alpha.1
Updatedgl-matrix@^3.4.3