
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A high-performance TypeScript math library specially optimized for WebGL applications.
Pronounced as "Matthew" ( mˈæθjuː ).
Standard math libraries often create new objects for every calculation, causing Garbage Collection (GC) spikes that ruin the performance of real-time rendering loops (60fps+).
mathue is designed to be "Zero-Allocation" by default.
.clone() and factory methods (e.g., .identity(), .zero()) for when you need immutable behavior.this, allowing for concise and readable code similar to modern engines..d.ts) included.npm install mathue
// Applies matrix to vector
import {Vector3, Matrix4, Quaternion} from 'mathue';
const v = new Vector3(1, 2, 3);
const axis = new Vector3(0, 0, 1);
const angle = Math.PI / 3;
const q = Quaternion.fromAxisAndAngle(axis, angle);
const m = Matrix4.identity();
m.setQuaternion(q);
v.applyMatrix4(m);
// Calculates model matrix
const position = new Vector3(1, 2, 3);
const rotation = Quaternion.identity();
const scale = new Vector3(2, 2, 2);
const model = Matrix4.identity();
model.setIdentity()
.multiplyTranslation(position)
.multiplyRotation(rotation)
.multiplyScale(scale);
// Calculates view matrix
const phi = 0.25 * Math.PI;
const theta = 0.5 * Math.PI;
const radius = 2;
const polar = new PolarCoordinate3(phi, theta, radius);
// A camera on a sphere looking at the origin
const target = Vector3.zero();
const position = Vector3.zero();
const up = Vector3.zero();
polar.toVector3(position);
polar.toTangentZ(tangent);
const view = Matrix4.identity();
view.lookAt(position, target, up);
// Calculates projection matrix (Perspective camera)
const {projection, clientSize, _verticalFov, _near, _far} = this;
const verticalFov = 0.5 * Math.PI;
const near = 0.1;
const far = 4.0;
const aspect = 1.5; // width / height
// for WebGL, OpenGL, ...
const projection = Matrix4.identity();
projection.perspective(verticalFov, near, far, aspect);
// for WebGPU, Vulkan, DirectX, Metal, ...
const options = { depthZeroToOne: true };
projection.perspective(verticalFov, near, far, aspect, options);
// Calculates projection matrix (Orthographic camera)
const left = -3;
const right = 3;
const bottom = -2;
const top = 2;
const near = 0.1;
const far = 4.0;
// for WebGL, OpenGL, ...
const projection = Matrix4.identity();
projection.orthographic(left, right, bottom, top, near, far);
// for WebGPU, Vulkan, DirectX, Metal, ...
const options = { depthZeroToOne: true };
projection.orthographic(left, right, bottom, top, near, far, options);
See the Full Documentation for details.
MIT License
The logo features two upward vectors arranged to form the letter "M".
Conceptually, the right vector represents the left vector transformed by a Matrix or Quaternion.
FAQs
TypeScript math library
We found that mathue 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.