Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gtklocker/linearjs
Linear algebra in JS.
https://github.com/gtklocker/linearjs
Last synced: 17 days ago
JSON representation
Linear algebra in JS.
- Host: GitHub
- URL: https://github.com/gtklocker/linearjs
- Owner: gtklocker
- Created: 2012-11-18T00:01:12.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2012-12-01T09:54:16.000Z (almost 12 years ago)
- Last Synced: 2024-10-07T19:41:26.339Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 133 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
LinearJS
========**Warning: LinearJS doesn't check an operation can be applied to two objects
and it will NOT fail gracefully if you don't provide objects that can be operated on.**About
-----
LinearJS is a library I started writing to use with some WebGL
applications I made. It allows you to do operations (mentioned below) on vectors
and matrices, no matter what their dimensions are. It has a pretty clean API
that is inspired by Sylvester and it just gets the job done.Supported operations
--------------------
For vectors:* addition
* subtraction
* scaling
* dot product
* cross product (for 3d vectors only)
* normalizationFor matrices:
* addition
* subtraction
* transpose
* multiplicationKeep in mind that those operations are supposed to work for whatever dimensions
you like.How to use
----------
In order to use LinearJS, you have to include the
following files in your project, in the exact order:* array.js
* vector.js
* matrix.jsmatrix.js depends on vector.js, which both depend on array.js... you get it.
Now, some examples. First go matrices.
var a = new Matrix( [ [ 1 ], [ 2 ], [ 3 ] ]);
a = a.multiply( Matrix.rotateX( Math.PI / 6 ) );And vectors.
var v = new Vector( [ 1, 2 ] );
v = v.add( new Vector( [ 3, 4 ] );