Skip to content

vector class for common vector operations, default support for arbitrary-precision decimal arithmetic

License

Notifications You must be signed in to change notification settings

boycgit/maths-vector

Repository files navigation

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.

About

vector class for common vector operations, default support for arbitrary-precision decimal arithmetic

Resources

License

Stars

Watchers

Forks

Packages

No packages published