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

math.gl

Package Overview
Dependencies
Maintainers
10
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

math.gl

Array-based 3D Math Classes optimized for WebGL applications

  • 3.5.0-alpha.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
102K
decreased by-9.63%
Maintainers
10
Weekly downloads
 
Created

What is math.gl?

math.gl is a suite of JavaScript libraries designed for high-precision mathematical computations, particularly in the context of computer graphics and geospatial applications. It provides a range of utilities for vector and matrix operations, geospatial transformations, and more.

What are math.gl's main functionalities?

Vector Operations

math.gl provides a comprehensive set of vector operations. This example demonstrates how to create vectors and perform addition.

const {Vector3} = require('math.gl');
const v1 = new Vector3(1, 2, 3);
const v2 = new Vector3(4, 5, 6);
const v3 = v1.add(v2);
console.log(v3); // Vector3 { x: 5, y: 7, z: 9 }

Matrix Operations

math.gl supports various matrix operations. This example shows how to create identity and translation matrices and multiply them.

const {Matrix4} = require('math.gl');
const m1 = new Matrix4().identity();
const m2 = new Matrix4().translate([1, 2, 3]);
const m3 = m1.multiplyRight(m2);
console.log(m3); // Matrix4 { elements: [1, 0, 0, 1, 0, 1, 0, 2, 0, 0, 1, 3, 0, 0, 0, 1] }

Geospatial Transformations

math.gl includes utilities for geospatial transformations. This example demonstrates converting cartographic coordinates to Cartesian coordinates using an ellipsoid model.

const {Ellipsoid} = require('math.gl/geospatial');
const ellipsoid = new Ellipsoid(6378137.0, 6356752.314245);
const cartesian = ellipsoid.cartographicToCartesian([0.1, 0.1, 0]);
console.log(cartesian); // Vector3 { x: 6378137.0, y: 11131.949079327358, z: 11131.949079327358 }

Other packages similar to math.gl

FAQs

Package last updated on 24 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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