vectored

A JavaScript 2 and 3D vector math library

Usage no npm install needed!

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

README

Vectored

A JavaScript 2 and 3D vector math library

Installation

Node.js

npm install vectored
const Vec = require('./vec.js');

let vector = new Vec(4, 2, 0);

In browser

Include the script inside the html

<!-- Link to file directly -->
<script src="./vec.js"></script>

<!-- or latest via url -->
<script src="https://cdn.jsdelivr.net/npm/vectored@latest/build/vec.min.js"></script>

<!-- or to a specific version-->
<script src="https://cdn.jsdelivr.net/npm/vectored@0.4/build/vec.min.js"></script>

<!-- you can use vec.js here -->
<script src="/"></script>

How to use

Creating a vector

let vec1 = new Vec(3, 4);

Adding vectors

let vec1 = new Vec(3, 5);
let vec2 = new Vec(2, 1);

vec1.add(vec2);
console.log(vec1);
// -> Vec {x: 5, y: 6, z: 0}

For all vector opperations and explenations see the full documentations

Documentation

link to documentation

License

Licensed by MIT