vector3d
v1.0.5
Published
Library to implement 3D vector algebra
Downloads
8
Readme
vector3d
Just another Javascript implementation of immutable 3D vectors.
install
browser
<script type="text/javascript" src="vector3d.min.js"></script>
node
npm install vector3d
usage
// Create vectors by assigning each coordinate.
const v1 = Vector3d(1.2, 3.4, 5.6)
const v2 = Vector3d(7.8, 9.1, 2.3)
// Set/return Cartesian coordinates.
v1.x()
// => 1.2
v2.x(4.5)
// => Vector3d(4.5, 3.4, 5.6)
// Add/subtract two vectors.
v1.add(v2)
// => Vector3d(9.0, 12.5, 7.9)
v1.sub(v2)
// => Vector3d(-6.6, -5.7, 3.3)
documentation
At the moment, documentation is available in the source code.