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

@pixi/math

Package Overview
Dependencies
Maintainers
2
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/math

Collection of math utilities

  • 7.2.0-rc.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
121K
decreased by-2.73%
Maintainers
2
Weekly downloads
 
Created

What is @pixi/math?

@pixi/math is a utility library for mathematical operations and geometric transformations, primarily used in conjunction with the PixiJS rendering library. It provides a set of classes and functions to handle common mathematical tasks such as vector operations, matrix transformations, and geometric calculations.

What are @pixi/math's main functionalities?

Vector Operations

The @pixi/math package provides a Point class for 2D vector operations. You can create points, add them, and perform other vector operations.

const { Point } = require('@pixi/math');

const point1 = new Point(10, 20);
const point2 = new Point(30, 40);
const result = point1.add(point2);
console.log(result); // Point { x: 40, y: 60 }

Matrix Transformations

The Matrix class allows for complex 2D transformations including translation, scaling, and rotation. This is useful for manipulating objects in a 2D space.

const { Matrix } = require('@pixi/math');

const matrix = new Matrix();
matrix.translate(10, 20);
matrix.scale(2, 2);
console.log(matrix); // Matrix { a: 2, b: 0, c: 0, d: 2, tx: 10, ty: 20 }

Rectangle and Circle Geometry

The package includes classes for geometric shapes like Rectangle and Circle, which provide methods to check for containment and intersection.

const { Rectangle, Circle } = require('@pixi/math');

const rect = new Rectangle(0, 0, 100, 100);
const circle = new Circle(50, 50, 25);
console.log(rect.contains(50, 50)); // true
console.log(circle.contains(50, 50)); // true

Other packages similar to @pixi/math

FAQs

Package last updated on 10 Mar 2023

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