A 3-dimensional vector and associated utility functions (pronouced: Ex Why Zed)
npm install xyzed --save
const {Vector, mul} = require('xyzed');
const x = 3, y = 5, z = 7;
const vec = Vector(x, y, z); // or {x, y, z}
const result = mul(vec, 4);
// result becomes a new vector: {x: 12, y: 20, z: 28}
npm test
add(v1, v2)
Adds two vectorssub(v1, v2)
Subtracts two vectorsmul(vec, int)
Multiplies a vector with a scalarrotate(vec, matrix)
Rotates a vector with a matrixabs(vec)
Returns the absolute value of a vector
Pull requests welcomed. Please lint and supply new/updated tests for your code.
- 0.1.0 Initial release
- 0.2.0 Convert to TypeScript. Replace Mocha/Chai with Jest. Change license to Apache-2.0.