voctor
v2.1.1
Published
voctor is a versatile and high-performance library for vector mathematics, providing easy-to-use implementations for vectors
Downloads
23
Maintainers
Readme
Voctor
Voctor is a versatile and high-performance library for vector mathematics, providing easy-to-use implementations for vectors. Ideal for applications in graphics, gaming, and scientific computing, it offers efficient arithmetic operations, vector manipulations, and utility functions like normalization and distance calculations. Integrate voctor
into your project with ease to streamline vector operations and enhance your computational tasks.
Installation:
npm install voctor
Usage Example:
import { Vec2, Vec3 } from "voctor";
{
const a = new Vec2(1, 5);
const b = Vec2.fromArray([1, 0]);
console.log(a.add(b)); // Vec2 { x: 2, y: 5 }
}
{
const a = Vec3.fromScaler(100);
const b = Vec3.fromObject({
x: 1,
y: 8,
z: 16,
});
console.log(a.sub(b)); // Vec3 { x: 99, y: 92, z: 84 }
}