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

@antv/matrix-util

Package Overview
Dependencies
Maintainers
33
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/matrix-util

A common util collection for antv projects

  • 3.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
33
Created

What is @antv/matrix-util?

@antv/matrix-util is a utility library for matrix operations, commonly used in graphics and data visualization. It provides functions for matrix transformations, vector operations, and other mathematical computations that are essential for manipulating graphical elements.

What are @antv/matrix-util's main functionalities?

Matrix Multiplication

This feature allows you to multiply two 3x3 matrices. The code sample demonstrates how to use the `mat3.multiply` function to multiply two matrices and log the result.

const { mat3 } = require('@antv/matrix-util');
const matrixA = [1, 0, 0, 0, 1, 0, 0, 0, 1];
const matrixB = [2, 0, 0, 0, 2, 0, 0, 0, 2];
const result = mat3.multiply([], matrixA, matrixB);
console.log(result); // [2, 0, 0, 0, 2, 0, 0, 0, 2]

Vector Transformation

This feature allows you to transform a 2D vector using a 3x3 matrix. The code sample demonstrates how to use the `vec2.transformMat3` function to transform a vector and log the result.

const { vec2 } = require('@antv/matrix-util');
const vector = [1, 2];
const matrix = [1, 0, 0, 0, 1, 0, 2, 3, 1];
const result = vec2.transformMat3([], vector, matrix);
console.log(result); // [3, 5]

Matrix Inversion

This feature allows you to invert a 3x3 matrix. The code sample demonstrates how to use the `mat3.invert` function to invert a matrix and log the result.

const { mat3 } = require('@antv/matrix-util');
const matrix = [1, 2, 3, 0, 1, 4, 5, 6, 0];
const result = mat3.invert([], matrix);
console.log(result); // [ -24, 18, 5, 20, -15, -4, -5, 4, 1 ]

Other packages similar to @antv/matrix-util

Keywords

FAQs

Package last updated on 21 Dec 2020

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