maths-vector
v1.1.0
Published
[![Build Status](https://travis-ci.org/boycgit/maths-vector.svg?branch=master)](https://travis-ci.org/boycgit/maths-vector) [![Coverage Status](https://coveralls.io/repos/github/boycgit/maths-vector/badge.svg?branch=master)](https://coveralls.io/github/bo
Downloads
6
Readme
maths-vector
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.