1.1.0 • Published 6 years ago

maths-vector v1.1.0

Weekly downloads
9
License
-
Repository
github
Last release
6 years ago

maths-vector

Build Status Coverage Status MIT Licence npm version

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.

features

  • 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.

Installation

Node.js / Browserify

npm install maths-vector --save
var Vector = require('maths-vector');
var vec = new Vector(42, 1337);

Global object

Include the pre-built script.

<script src="./dist/vector.umd.js"></script>
<script>
var vec = new Vector(42, 1337);
</script>

Build & test

npm run build
npm test

Document

npm run doc

then open the generated out/index.html file in your browser.

License

MIT.