vectr2

A simple 2d Vector class in javascript

Usage no npm install needed!

<script type="module">
  import vectr2 from 'https://cdn.skypack.dev/vectr2';
</script>

README

vectr2

Simple 2d vector class in javascript.

NPM

npm install vectr2 --save
Vectr2 = require('vectr2');
var vectorA = new Vectr2(0,0);
var vectorB = new Vectr2(1,2);

Project onto another vector.

var vectorC = vectorA.project(vectorB);

Get the dot product.

var dotProd = vectorA.dot(vectorB);

Find the angle between two vectors.

var theta = vectorA.angle(vectorB);