Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
transformation-matrix
Advanced tools
2d transformation matrix functions written in ES6 syntax. Tree shaking ready!
The 'transformation-matrix' npm package provides a set of utilities for working with 2D affine transformations. It allows you to create, manipulate, and apply transformation matrices for operations such as translation, rotation, scaling, and skewing.
Translation
This feature allows you to create a translation matrix that moves points by a specified distance along the x and y axes.
const { translate } = require('transformation-matrix');
const translationMatrix = translate(10, 20);
console.log(translationMatrix);
Rotation
This feature allows you to create a rotation matrix that rotates points by a specified angle in radians.
const { rotate } = require('transformation-matrix');
const rotationMatrix = rotate(Math.PI / 4);
console.log(rotationMatrix);
Scaling
This feature allows you to create a scaling matrix that scales points by specified factors along the x and y axes.
const { scale } = require('transformation-matrix');
const scalingMatrix = scale(2, 3);
console.log(scalingMatrix);
Skewing
This feature allows you to create a skewing matrix that skews points by specified angles along the x and y axes.
const { skew } = require('transformation-matrix');
const skewingMatrix = skew(0.5, 0.3);
console.log(skewingMatrix);
Combining Transformations
This feature allows you to combine multiple transformation matrices into a single matrix.
const { compose, translate, rotate, scale } = require('transformation-matrix');
const combinedMatrix = compose(translate(10, 20), rotate(Math.PI / 4), scale(2, 3));
console.log(combinedMatrix);
The 'gl-matrix' package is a high-performance matrix and vector library for WebGL. It provides similar functionalities for 2D and 3D transformations, but is more focused on performance and is widely used in graphics programming.
The 'transformation-matrix-js' package offers similar functionalities for 2D transformations, including translation, rotation, scaling, and skewing. It is a lightweight alternative with a focus on simplicity.
The 'matrix-js' package provides general-purpose matrix operations, including those for 2D transformations. It is more versatile but less specialized compared to 'transformation-matrix'.
Javascript isomorphic 2D affine transformations written in ES6 syntax. Manipulate transformation matrices with this totally tested library!
Transformations, i.e. linear invertible automorphisms, are used to map a picture into another one with different size, position and orientation. Given a basis, transformations are represented by means of squared invertible matrices, called transformation matrices. A geometric transformation is defined as a one-to-one mapping of a point space to itself, which preservers some geometric relations of figures. - Geometric Programming for Computer Aided Design
This library allows us to:
Basic Operations
Calculate
Validate
Apply
Stringify
Compose
Decompose
Moving points (gestures)
npm install transformation-matrix
or
<script src="https://unpkg.com/transformation-matrix@2"></script>
import {scale, rotate, translate, compose, applyToPoint} from 'transformation-matrix';
let {scale, rotate, translate, compose, applyToPoint} = window.TransformationMatrix;
let {scale, rotate, translate, compose, applyToPoint} = require('transformation-matrix')
let matrix = compose(
translate(40,40),
rotate(Math.PI/2),
scale(2, 4)
);
applyToPoint(matrix, {x: 42, y: 42});
// { x: -128, y: 124.00000000000001 }
applyToPoint(matrix, [16, 24]);
// [ -56, 72 ]
translate(tx)
, scale(sx)
, rotate(angle, cx, cy)
fromTransformAttribute
, Discontinues node 4 supportskew(ax, ay)
, Upgrades deps, Improves fromTransformAttribute
compose
function, Upgrades deps, Exposes skew operation #37Array
in the form [x, y]
#38fromTriangle
and smoothMatrix
functions #41fromDefinition
function; breaking changes on fromTransformAttribute
function; improves docs(cx,cy)
on scale
function #62; Improves typescript definition #66; Upgrades depsflipX()
, flipY()
, flipOrigin()
functions; Deprecates NodeJS 12 and adds NodeJS 16 support; Upgrades deps;decomposeTSR()
function #88; Upgrades deps;fromOneMovingPoint
and fromTwoMovingPoints
functions #95FAQs
2d transformation matrix functions written in ES6 syntax. Tree shaking ready!
The npm package transformation-matrix receives a total of 28,725 weekly downloads. As such, transformation-matrix popularity was classified as popular.
We found that transformation-matrix demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.