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

@math.gl/core

Package Overview
Dependencies
Maintainers
2
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@math.gl/core

Array-based 3D Math Classes optimized for WebGL applications

  • 4.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is @math.gl/core?

@math.gl/core is a JavaScript library that provides a suite of mathematical utilities for 3D graphics and geospatial applications. It includes functions for vector and matrix operations, quaternion calculations, and other mathematical computations commonly used in computer graphics and geospatial applications.

What are @math.gl/core's main functionalities?

Vector Operations

This feature allows you to perform vector operations such as addition, subtraction, and normalization. The code sample demonstrates how to create vectors and add them together.

const { Vector3 } = require('@math.gl/core');
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

This feature provides functions for matrix operations such as multiplication, inversion, and transformation. The code sample shows how to create identity and translation matrices and multiply them.

const { Matrix4 } = require('@math.gl/core');
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] }

Quaternion Calculations

This feature allows you to perform quaternion calculations such as creating quaternions from axis rotations and multiplying quaternions. The code sample demonstrates how to create and multiply quaternions.

const { Quaternion } = require('@math.gl/core');
const q1 = new Quaternion().fromAxisRotation([0, 1, 0], Math.PI / 2);
const q2 = new Quaternion().fromAxisRotation([1, 0, 0], Math.PI / 2);
const q3 = q1.multiply(q2);
console.log(q3); // Quaternion { x: 0.5, y: 0.5, z: 0.5, w: 0.5 }

Other packages similar to @math.gl/core

Keywords

FAQs

Package last updated on 08 Sep 2024

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