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

gl-mat4

Package Overview
Dependencies
Maintainers
13
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gl-mat4

gl-matrix's mat4, split into smaller pieces

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
196K
decreased by-1.45%
Maintainers
13
Weekly downloads
 
Created

What is gl-mat4?

The gl-mat4 npm package is a utility library for performing operations on 4x4 matrices, which are commonly used in WebGL and other graphics programming contexts. It provides a variety of functions for creating, manipulating, and transforming 4x4 matrices.

What are gl-mat4's main functionalities?

Matrix Creation

This feature allows you to create a new 4x4 identity matrix. An identity matrix is a special kind of matrix that doesn't change any vector when we multiply that vector by this matrix.

const mat4 = require('gl-mat4');
const identityMatrix = mat4.create();

Matrix Multiplication

This feature allows you to multiply two 4x4 matrices. Matrix multiplication is a fundamental operation in graphics programming for combining multiple transformations.

const mat4 = require('gl-mat4');
const a = mat4.create();
const b = mat4.create();
const result = mat4.multiply(mat4.create(), a, b);

Matrix Translation

This feature allows you to apply a translation transformation to a 4x4 matrix. Translation is used to move objects in 3D space.

const mat4 = require('gl-mat4');
const out = mat4.create();
const translation = [1, 2, 3];
mat4.translate(out, out, translation);

Matrix Rotation

This feature allows you to apply a rotation transformation to a 4x4 matrix. Rotation is used to rotate objects around a specified axis.

const mat4 = require('gl-mat4');
const out = mat4.create();
const rad = Math.PI / 4;
const axis = [0, 0, 1];
mat4.rotate(out, out, rad, axis);

Matrix Scaling

This feature allows you to apply a scaling transformation to a 4x4 matrix. Scaling is used to resize objects in 3D space.

const mat4 = require('gl-mat4');
const out = mat4.create();
const scale = [2, 2, 2];
mat4.scale(out, out, scale);

Other packages similar to gl-mat4

Keywords

FAQs

Package last updated on 19 Apr 2018

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