lineal
v0.0.1
Published
A fast and elegant vector/matrix calculation framework for JavaScript and friends
Downloads
4
Maintainers
Readme
Lineal
Lineal is a linear algebra toolkit, for easily and efficiently working with
vectors and matrices. It noninvasively extends the prototype of certain arrays
to give you just that bit more ease of use than its sister package gl-matrix
has to offer, while having only a small and acceptable performance overhead.
npm i lineal
Usage
Lineal has a very similar API to gl-matrix
, so check out their
documentation for more information. In general,
lineal provides static methods that return a brand-new vector or matrix and
that work on any vector-like structure (i.e. not necessarily a new Vec2()
),
and a set of member methods that either mutate the given lineal vector or
matrix, or return some kind of computed value. This all sounds more complex
than it really is, so let's check out some examples.
import Vec2 from "lineal/vec2"
const v1 = new Vec2(1, 2)
v1.add([3, 4])
// v1 is now equal to [3, 6]
const v2 = Vec2.add([1, 2], [3, 4]) // returns a brand-new Vec2([3,6])
v2.length() // returns 6.7082039325
That's it! Documentation is coming soon; for now you can just read the source code, which is not difficult to read. If you found any bugs, please report them in the issue tracker so they can be fixed. Have fun programming!