Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@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.6.3 to 4.0.0-alpha.1

dist/constants.js

15

dist/ellipsoid/ellipsoid.d.ts
import { Vector3, Matrix4, NumericArray } from '@math.gl/core';
import type { AxisDirection } from './helpers/ellipsoid-transform';
/**

@@ -31,13 +32,13 @@ * A quadratic surface defined in Cartesian coordinates by the equation

* The cartesian is undefined at the center of the ellipsoid. */
cartesianToCartographic(cartesian: number[], result: Vector3): Vector3;
cartesianToCartographic(cartesian: number[], result?: number[]): number[];
cartesianToCartographic(cartesian: Readonly<NumericArray>, result: Vector3): Vector3;
cartesianToCartographic(cartesian: Readonly<NumericArray>, result?: number[]): number[];
/** Computes a 4x4 transformation matrix from a reference frame with an east-north-up axes
* centered at the provided origin to the provided ellipsoid's fixed reference frame. */
eastNorthUpToFixedFrame(origin: number[], result?: Matrix4): Matrix4;
eastNorthUpToFixedFrame(origin: number[], result: number[]): number[];
eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result?: Matrix4): Matrix4;
eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result: number[]): number[];
/** Computes a 4x4 transformation matrix from a reference frame centered at
* the provided origin to the ellipsoid's fixed reference frame.
*/
localFrameToFixedFrame(firstAxis: string, secondAxis: string, thirdAxis: string, origin: Readonly<NumericArray>, result?: Matrix4): Matrix4;
localFrameToFixedFrame<Matrix4T>(firstAxis: string, secondAxis: string, thirdAxis: string, origin: Readonly<NumericArray>, result: number[]): number[];
localFrameToFixedFrame(firstAxis: AxisDirection, secondAxis: AxisDirection, thirdAxis: AxisDirection, origin: Readonly<NumericArray>, result?: Matrix4): Matrix4;
localFrameToFixedFrame<Matrix4T>(firstAxis: AxisDirection, secondAxis: AxisDirection, thirdAxis: AxisDirection, origin: Readonly<NumericArray>, result: number[]): number[];
/** Computes the unit vector directed from the center of this ellipsoid toward

@@ -48,3 +49,3 @@ * the provided Cartesian position. */

/** Computes the normal of the plane tangent to the surface of the ellipsoid at provided position. */
geodeticSurfaceNormalCartographic<NumArray>(cartographic: number[], result: NumArray): NumArray;
geodeticSurfaceNormalCartographic<NumArray>(cartographic: Readonly<NumericArray>, result: NumArray): NumArray;
geodeticSurfaceNormalCartographic(cartographic: number[]): number[];

@@ -51,0 +52,0 @@ /** Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position. */

@@ -0,5 +1,5 @@

import { NumericArray } from '@math.gl/core';
import type Ellipsoid from '../ellipsoid';
declare type Axis = 'up' | 'down' | 'north' | 'east' | 'south' | 'west';
export default function localFrameToFixedFrame(ellipsoid: Ellipsoid, firstAxis: Axis, secondAxis: Axis, thirdAxis: Axis, cartesianOrigin: number[], result: number[]): number[];
export {};
export type AxisDirection = 'up' | 'down' | 'north' | 'east' | 'south' | 'west';
export default function localFrameToFixedFrame(ellipsoid: Ellipsoid, firstAxis: AxisDirection, secondAxis: AxisDirection, thirdAxis: AxisDirection, cartesianOrigin: Readonly<NumericArray>, result: number[]): number[];
//# sourceMappingURL=ellipsoid-transform.d.ts.map
import type { NumericArray } from '@math.gl/core';
declare type LngLatHeightObject = {
type LngLatHeightObject = {
longitude: number;

@@ -7,3 +7,3 @@ latitude: number;

};
declare type XYZObject = {
type XYZObject = {
x: number;

@@ -13,9 +13,9 @@ y: number;

};
declare type Cartographic = LngLatHeightObject | XYZObject | NumericArray;
export declare function fromCartographic(cartographic: Cartographic): number[];
export declare function fromCartographic<NumArrayT>(cartographic: Cartographic, result: NumArrayT, map?: (x: number) => number): NumArrayT;
export declare function fromCartographicToRadians(cartographic: Cartographic, result?: number[]): number[];
export declare function fromCartographicToRadians<TArray>(cartographic: Cartographic, result: TArray): TArray;
export declare function fromCartographicToDegrees(cartographic: Cartographic, result?: number[]): number[];
export declare function fromCartographicToDegrees<TArray>(cartographic: Cartographic, result: TArray): TArray;
type Cartographic = LngLatHeightObject | XYZObject | NumericArray;
export declare function fromCartographic(cartographic: Readonly<Cartographic>): number[];
export declare function fromCartographic<NumArrayT>(cartographic: Readonly<Cartographic>, result: NumArrayT, map?: (x: number) => number): NumArrayT;
export declare function fromCartographicToRadians(cartographic: Readonly<Cartographic>, result?: number[]): number[];
export declare function fromCartographicToRadians<TArray>(cartographic: Readonly<Cartographic>, result: TArray): TArray;
export declare function fromCartographicToDegrees(cartographic: Readonly<Cartographic>, result?: number[]): number[];
export declare function fromCartographicToDegrees<TArray>(cartographic: Readonly<Cartographic>, result: TArray): TArray;
export declare function toCartographic<T extends Cartographic>(vector: Readonly<NumericArray>, cartographic: T, map?: (x: number) => number): T;

@@ -22,0 +22,0 @@ export declare function toCartographicFromRadians<T extends Cartographic>(vector: Readonly<NumericArray>, cartographic: T): T;

@@ -5,6 +5,7 @@ {

"license": "MIT",
"type": "module",
"publishConfig": {
"access": "public"
},
"version": "3.6.3",
"version": "4.0.0-alpha.1",
"keywords": [

@@ -28,4 +29,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": [

@@ -37,6 +38,6 @@ "dist",

"@babel/runtime": "^7.12.0",
"@math.gl/core": "3.6.3",
"gl-matrix": "^3.4.0"
"@math.gl/core": "4.0.0-alpha.1",
"gl-matrix": "^3.4.3"
},
"gitHead": "0efab394df9babad7ed93027c1003f30528b2090"
"gitHead": "66f872ea615a3ef81431595727cdf58dcadf3670"
}

@@ -5,12 +5,4 @@ // This file is derived from the Cesium math library under Apache 2 license

/* eslint-disable */
import {
Vector3,
Matrix4,
toRadians,
toDegrees,
assert,
equals,
_MathUtils,
NumericArray
} from '@math.gl/core';
import {Vector3, Matrix4, assert, equals, _MathUtils, NumericArray} from '@math.gl/core';
// @ts-ignore gl-matrix typings...
import * as vec3 from 'gl-matrix/vec3';

@@ -21,4 +13,5 @@

import type {AxisDirection} from './helpers/ellipsoid-transform';
import localFrameToFixedFrame from './helpers/ellipsoid-transform';
import scaleToGeodeticSurface from './helpers/scale-to-geodetic-surface';
import localFrameToFixedFrame from './helpers/ellipsoid-transform';

@@ -32,4 +25,2 @@ const scratchVector = new Vector3();

let wgs84;
/**

@@ -106,3 +97,3 @@ * A quadratic surface defined in Cartesian coordinates by the equation

cartographicToCartesian(cartographic, result = [0, 0, 0]) {
cartographicToCartesian(cartographic: Readonly<NumericArray>, result = [0, 0, 0]) {
const normal = scratchNormal;

@@ -127,6 +118,6 @@ const k = scratchK;

* The cartesian is undefined at the center of the ellipsoid. */
cartesianToCartographic(cartesian: number[], result: Vector3): Vector3;
cartesianToCartographic(cartesian: number[], result?: number[]): number[];
cartesianToCartographic(cartesian: Readonly<NumericArray>, result: Vector3): Vector3;
cartesianToCartographic(cartesian: Readonly<NumericArray>, result?: number[]): number[];
cartesianToCartographic(cartesian, result = [0, 0, 0]) {
cartesianToCartographic(cartesian: Readonly<NumericArray>, result = [0, 0, 0]) {
scratchCartesian.from(cartesian);

@@ -153,6 +144,6 @@ const point = this.scaleToGeodeticSurface(scratchCartesian, scratchPosition);

* centered at the provided origin to the provided ellipsoid's fixed reference frame. */
eastNorthUpToFixedFrame(origin: number[], result?: Matrix4): Matrix4;
eastNorthUpToFixedFrame(origin: number[], result: number[]): number[];
eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result?: Matrix4): Matrix4;
eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result: number[]): number[];
eastNorthUpToFixedFrame(origin, result = new Matrix4()) {
eastNorthUpToFixedFrame(origin: Readonly<NumericArray>, result = new Matrix4()) {
return localFrameToFixedFrame(this, 'east', 'north', 'up', origin, result);

@@ -165,5 +156,5 @@ }

localFrameToFixedFrame(
firstAxis: string,
secondAxis: string,
thirdAxis: string,
firstAxis: AxisDirection,
secondAxis: AxisDirection,
thirdAxis: AxisDirection,
origin: Readonly<NumericArray>,

@@ -173,5 +164,5 @@ result?: Matrix4

localFrameToFixedFrame<Matrix4T>(
firstAxis: string,
secondAxis: string,
thirdAxis: string,
firstAxis: AxisDirection,
secondAxis: AxisDirection,
thirdAxis: AxisDirection,
origin: Readonly<NumericArray>,

@@ -183,3 +174,9 @@ result: number[]

// the provided origin to the ellipsoid's fixed reference frame.
localFrameToFixedFrame(firstAxis, secondAxis, thirdAxis, origin, result = new Matrix4()) {
localFrameToFixedFrame(
firstAxis: AxisDirection,
secondAxis: AxisDirection,
thirdAxis: AxisDirection,
origin: Readonly<NumericArray>,
result = new Matrix4()
) {
return localFrameToFixedFrame(this, firstAxis, secondAxis, thirdAxis, origin, result);

@@ -192,3 +189,3 @@ }

geocentricSurfaceNormal<NumArray>(cartesian: number[], result: NumArray): NumArray;
geocentricSurfaceNormal(cartesian, result = [0, 0, 0]) {
geocentricSurfaceNormal(cartesian: Readonly<NumericArray>, result = [0, 0, 0]) {
return scratchVector.from(cartesian).normalize().to(result);

@@ -198,5 +195,8 @@ }

/** Computes the normal of the plane tangent to the surface of the ellipsoid at provided position. */
geodeticSurfaceNormalCartographic<NumArray>(cartographic: number[], result: NumArray): NumArray;
geodeticSurfaceNormalCartographic<NumArray>(
cartographic: Readonly<NumericArray>,
result: NumArray
): NumArray;
geodeticSurfaceNormalCartographic(cartographic: number[]): number[];
geodeticSurfaceNormalCartographic(cartographic, result = [0, 0, 0]) {
geodeticSurfaceNormalCartographic(cartographic: Readonly<NumericArray>, result = [0, 0, 0]) {
const cartographicVectorRadians = fromCartographicToRadians(cartographic);

@@ -219,3 +219,3 @@

geodeticSurfaceNormal(cartesian: number[]): number[];
geodeticSurfaceNormal(cartesian, result = [0, 0, 0]) {
geodeticSurfaceNormal(cartesian: Readonly<NumericArray>, result = [0, 0, 0]) {
return scratchVector.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);

@@ -222,0 +222,0 @@ }

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

import {Vector3, assert, equals as equalsEpsilon} from '@math.gl/core';
import {NumericArray, Vector3, assert, equals as equalsEpsilon} from '@math.gl/core';

@@ -9,4 +9,9 @@ import type Ellipsoid from '../ellipsoid';

export type AxisDirection = 'up' | 'down' | 'north' | 'east' | 'south' | 'west';
// Caclulate third axis from given two axii
const VECTOR_PRODUCT_LOCAL_FRAME = {
const VECTOR_PRODUCT_LOCAL_FRAME: Record<
AxisDirection,
Partial<Record<AxisDirection, AxisDirection>>
> = {
up: {

@@ -72,4 +77,2 @@ south: 'east',

type Axis = 'up' | 'down' | 'north' | 'east' | 'south' | 'west';
// Computes a 4x4 transformation matrix from a reference frame

@@ -80,11 +83,10 @@ // centered at the provided origin to the provided ellipsoid's fixed reference frame.

ellipsoid: Ellipsoid,
firstAxis: Axis,
secondAxis: Axis,
thirdAxis: Axis,
cartesianOrigin: number[],
firstAxis: AxisDirection,
secondAxis: AxisDirection,
thirdAxis: AxisDirection,
cartesianOrigin: Readonly<NumericArray>,
result: number[]
): number[] {
const thirdAxisInferred =
VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] &&
(VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis] as Axis);
VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] && VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis];
// firstAxis and secondAxis must be east, north, up, west, south or down.');

@@ -91,0 +93,0 @@ assert(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));

@@ -28,5 +28,5 @@ // This file is derived from the Cesium math library under Apache 2 license

export function fromCartographic(cartographic: Cartographic): number[];
export function fromCartographic(cartographic: Readonly<Cartographic>): number[];
export function fromCartographic<NumArrayT>(
cartographic: Cartographic,
cartographic: Readonly<Cartographic>,
result: NumArrayT,

@@ -36,3 +36,3 @@ map?: (x: number) => number

export function fromCartographic(
cartographic: Cartographic,
cartographic: Readonly<Cartographic>,
result = [] as number[],

@@ -57,9 +57,12 @@ map = identity

export function fromCartographicToRadians(cartographic: Cartographic, result?: number[]): number[];
export function fromCartographicToRadians(
cartographic: Readonly<Cartographic>,
result?: number[]
): number[];
export function fromCartographicToRadians<TArray>(
cartographic: Cartographic,
cartographic: Readonly<Cartographic>,
result: TArray
): TArray;
export function fromCartographicToRadians(
cartographic: Cartographic,
cartographic: Readonly<Cartographic>,
vector = [] as number[]

@@ -70,9 +73,12 @@ ): number[] {

export function fromCartographicToDegrees(cartographic: Cartographic, result?: number[]): number[];
export function fromCartographicToDegrees(
cartographic: Readonly<Cartographic>,
result?: number[]
): number[];
export function fromCartographicToDegrees<TArray>(
cartographic: Cartographic,
cartographic: Readonly<Cartographic>,
result: TArray
): TArray;
export function fromCartographicToDegrees(
cartographic: Cartographic,
cartographic: Readonly<Cartographic>,
vector = [] as number[]

@@ -79,0 +85,0 @@ ): number[] {

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