Releases: AugustinMauroy/vec3
Releases · AugustinMauroy/vec3
v1.1.0
What's Changed
- feat: angleTo by @AugustinMauroy in #5
- refracto: archi structure by @AugustinMauroy in #6
- chore(node-v): use 24 by @AugustinMauroy in #7
- chore(pkg): bump version by @AugustinMauroy in #8
Full Changelog: v1.0.1...v1.1.0
v1.0.1
What's Changed
- bench: introduce by @AugustinMauroy in #2
- sert(ci): add codecov by @AugustinMauroy in #3
- chore: bump pkg v by @AugustinMauroy in #4
New Contributors
- @AugustinMauroy made their first contribution in #2
Full Changelog: v1.0.0...v1.0.1
v1.0.0
Release Notes - v1.0.0 (Initial Release)
This is the initial release of @augustinmauroy/vec3.
This library provides a small and efficient solution for 3D vector mathematics in JavaScript and TypeScript environments.
Examples
import { Vec3, v } from '@augustinmauroy/vec3';
// Create vectors using the constructor
const v1 = new Vec3(1, 2, 3);
const v2 = new Vec3(4, 5, 6);
// Create vectors using the helper function
const v3 = v(7, 8, 9); // From numbers
const v4 = v([10, 11, 12]); // From an array
const v5 = v({ x: 13, y: 14, z: 15 }); // From an object
const v6 = v('(1, -1, 3.14)'); // From a string representation
// Perform operations (most methods modify the vector in place)
v1.add(v2); // v1 is now (5, 7, 9)
console.log(v1.toString()); // Output: (5, 7, 9)
// Use immutable operations (return a new Vec3 instance)
const sum = v3.plus(v4); // sum is (17, 19, 21), v3 remains unchanged
console.log(sum.toString()); // Output: (17, 19, 21)
const scaled = v5.scaled(2); // scaled is (26, 28, 30), v5 remains unchanged
console.log(scaled.toString()); // Output: (26, 28, 30)
// Calculate distance
const distance = v1.distanceTo(v2);
console.log(distance);
// Normalize a vector
const normalized = v3.unit(); // normalized is a unit vector, v3 remains unchanged
console.log(normalized.norm()); // Output: ~1