Module @js-draw/math - v1.18.0

import { Vec2, Mat33, Rect2 } from '@js-draw/math';

// Example: Rotate a vector 90 degrees about the z-axis
const rotate90Degrees = Mat33.zRotation(Math.PI/2); // π/2 radians = 90 deg
const moveUp = Mat33.translation(Vec2.of(1, 0));
const moveUpThenRotate = rotate90Degrees.rightMul(moveUp);
console.log(moveUpThenRotate.transformVec2(Vec2.of(1, 2)));

// Example: Bounding box of some points
console.log(Rect2.bboxOf([
  Vec2.of(1, 2), Vec2.of(3, 4), Vec2.of(-100, 1000),
]));

@js-draw/math

A library with math utilities used by js-draw.

Index

Namespaces

Enumerations

Classes

Interfaces

Type Aliases

Functions

Generated using TypeDoc

OpenSource licenses