This repo is inspired by victor ,provide Vector class with methods for common vector operations。
The big difference from victor is that the Vector instance is immutable.
- immutable, a Vector is not changed by its methods.(victor is mutable,you should always call it's clone() function, so I had to create this new repo)
- include big.js, support for arbitrary-precision decimal arithmetic; you can always using other lib (like bignumber.js and decimal.js) with ease by config。
- manipulation functions are chainable, you can do
new Vector(1,2).add(2).multiply(3).dot(new Vector(4, 5))
and so on; - Can be used in both Node.js and the browser
- Open source, under the MIT license and can be used without restrictions.
npm install maths-vector --save
var Vector = require('maths-vector');
var vec = new Vector(42, 1337);
Include the pre-built script.
<script src="./dist/vector.umd.js"></script>
<script>
var vec = new Vector(42, 1337);
</script>
npm run build
npm test
npm run doc
then open the generated out/index.html
file in your browser.
MIT.