The library EWGL-matrices (http://code.google.com/p/ewgl-matrices/) was created as an alternative to the libraries Sylvester and glUtils.js, tested proving that EWGL-matrices faster Sylvester.

The library EWGL-matrices operates matrices 4x4 and vectors with three elements.
 
Matrices 4x4 are presented the class m4x4, and vectors – the class v3.
 
To work with matrices the EWGL-matrices library provides the static methods: I, set, $, makeFrustum, makePerspective, makeOrtho, makeRotate, and makeScale and the instance methods: identity, I, e, row, col, dimensions, rows, cols, eql, setElements, dup, map , add, substract, x, multiply, translate, rotate, scale, transpose, max, min, indexOf, diagonal, det, determinant, isSingular, tr, trace, inverse, view, and rand of the class m4x4.
 
To work with vectors the library EWGL-matrices provides the static method set and the instance methods: setElements, add, sub, mul, length, dot, and normalize of the class v3.
Class m4x4
The static methods of the class:
 
I
 
m4x4.I();
 
Creates an instance of the identity matrix with the elements
 
[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1].
 
 
 
 
set or $
 
Returns the matrix with the specified elements:
 
m4x4.set(1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4);
 
var array1 = [1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4];
 
m4x4.set(array1);
 
 
 
 
makeFrustum
 
Returns the projection matrix:
 
m4x4.makeFrustrum(left, right, bottom, top, znear, zfar);
 
 
 
 
makePerspective
 
Returns the projection matrix:
 
m4x4.makePerspective(fovy, aspect, znear, zfar);
 
 
 
 
makeOrtho
 
Returns the matrix of the orthogonal projection:
 
m4x4.makeOrtho(left, right, bottom, top, znear, zfar);
 
 
 
 
makeRotate
 
Returns the rotation matrix:
 
m4x4.makeRotate(angle,vector);
 
 
 
 
makeScale
 
Returns the matrix of scaling:
 
m4x4.makeScale(vector);
 
 
 
 
makeTranslate
 
Returns the matrix of translation:
 
m4x4.makeTranslate(vector);
 
 
 
 
The instance methods:
 
var m= new matrix(els);
 
 
 
 
identity or I
 
m.I() or m.identity()
 
Sets the matrix as the identity matrix.
 
 
 
 
E
 
m.e(i,j)
 
Returns the specified element of the matrix.
 
 
 
 
Row
 
m.row(i)
 
Returns the specified row of the matrix as the array.
 
 
 
 
Col
 
m.col(i)
 
Returns the specified column of the matrix as the array.
 
 
 
 
Dimensions
 
m.dimensions()
 
Returns the dimensions of the matrix as the string {'rows':4,'cols':4}.
 
 
 
 
Rows
 
m.rows()
 
Returns 4.
 
 
 
 
cols
 
m.cols()
 
Returns 4.
 
 
 
 
eql
 
m.eql(matrix)
 
Compares two matrices.
 
 
 
 
SetElements
 
m.setElements(els)
 
Sets the elements of the matrix.
 
 
 
 
Dup
 
m.dup()
 
Returns the copy of the matrix.
 
 
 
 
Map
 
m.map(fn)
 
Converts the elements of the matrix using the function.
 
 
 
 
add
 
m.add(matrix)
 
Add two matrices.
 
 
 
 
Substract
 
m.substract(matrix)
 
Subtracts two matrices.
 
 
 
 
X or multiply
 
m.multiply(matrix) or m.x(matrix)
 
Multiplies two matrices.
 
 
 
 
Translate
 
m.translate(vector)
 
Multiplies the matrix by the matrix of translation.
 
 
 
 
Rotate
 
m.rotate(theta,vector)
 
Multiplies the matrix by the rotation matrix.
 
 
 
 
Scale
 
m.scale(vector)
 
Multiplies the matrix by the scaling matrix.
 
 
 
 
Transpose
 
m.transpose()
 
Returns the transposed matrix.
 
 
 
 
Max
 
m.max()
 
Returns the maximum element of the matrix.
 
 
 
 
Min
 
m.min()
 
Returns the minimum element of a matrix.
 
 
 
 
IndexOf
 
m.indexOf(value)
 
Returns the position of the specified element of the matrix, or zero.
 
 
 
 
Diagonal
 
m.diagonal()
 
Returns the diagonal of the matrix.
 
 
 
 
Det or determinant
 
m.determinant() or m.det()
 
Returns the determinant of the matrix.
 
 
 
 
IsSingular
 
m.isSingular()
 
Returns true if the determinant is zero.
 
 
 
 
Tr or trace
 
m.trace() or m.tr()
 
Returns the sum of the diagonal matrix elements.
 
 
 
 
Inverse
 
m.inverse()
 
Returns the inverse of the matrix.
 
 
 
 
View
 
m.view()
 
Returns the string representation of the matrix.
 
 
 
 
rand
 
m.rand ()
 
Returns the matrix filled with random numbers.
 
 
 
 
Class v3
 
 
 
The static methods of the class:
 
set
 
v3.set(els)
 
Returns the matrix 4x4 containing the specified elements.
 
 
 
 
The instance methods:
 
v=new v3(els);
 
 
 
 
setElements
 
v.setElements(vector)
 
Sets the elements of the vector.
 
 
 
 
add
 
v.add(vector)
 
Adds two vectors.
 
 
 
 
sub
 
v.sub(vector)
 
Subtracts two vectors.
 
 
 
 
mul
 
v.mul(vector)
 
Multiplies two vectors.
 
 
 
 
length
 
v.length()
 
Returns the length of the vector.
 
 
 
 
dot
 
v.dot(vector)
 
Returns the dot product of two vectors.
 
 
 
 
normalize
 
v.normalize()
 
Normalizes the vector by multiplying its elements by the l = 1/Math.sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2]).
 

Our services

Our developments are at the forefront of high technologies

We design and develop web sites

Individual site design
Creating dynamic sites
Website layout and programming

We develop information systems

Automation of business processes for small and medium business
Collection, storage and processing of data
Using cloud technologies

We create mobile apps

Integration with a Web site
Creating mobile versions of web sites
Using Augmented Reality and Computer Vision

About us

NOV Tech Solutions specializes in developing services for operational management of business, creating web and mobile applications on order

NOV Tech Solutions is a team of highly qualified professionals working for the result

We work quickly and efficiently, using the most modern technologies

We appreciate and take care of our customers, constantly improving the service and expanding the list of services

Our partners

Contacts