Function Namespace Matrix
Defined in: matrix.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Matrix()
A matrix math library.
|
Field Attributes | Field Name and Description |
---|---|
<static> |
Matrix.IDENTITY
The identity matrix
|
<static> |
Matrix.R90
A ready to use matrix to make a 90 degree rotation.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
Matrix.add(m1, m2)
Add two matrixes.
|
<static> |
Matrix.clone(m)
Clones a matrix.
|
<static> |
Matrix.equals(m1, m2)
Compares two matrixes
|
<static> |
Matrix.multiply(m1, m2)
Multiply matrix m2 with m1
|
<static> |
Matrix.rotationMatrix(angle)
Creates a clockwise rotation matrix around the origin.
|
<static> |
Matrix.scaleMatrix(sx, sy)
Creates a scale matrix
|
<static> |
Matrix.subtract(m1, m2)
Substract matrix m2 from m1
|
<static> |
Matrix.translationMatrix(dx, dy)
Creates a translation matrix
|
Function Namespace Detail
Matrix()
A matrix math library.
Instead of creating of a so called Object we will only use matrixes as
array or arrays so Matrix will function more like a namespace instead
as an object.
All function are "static" / class methods...so no need to instanciate a Matrix object
Field Detail
<static>
Matrix.IDENTITY
The identity matrix
<static>
Matrix.R90
A ready to use matrix to make a 90 degree rotation.
It acts like a singleton.
It's more used for example and testings
Method Detail
<static>
{Array}
Matrix.add(m1, m2)
Add two matrixes.
It can be used to combine multiple transformations into one.
- Parameters:
- {Array} m1
- - first matrix
- {Array} m2
- - second matrix
- Returns:
- {Array} the sum of those 2 matrix
<static>
{Array}
Matrix.clone(m)
Clones a matrix. Recursivelly
Author: Alex Gheorghiu.
Author: Alex Gheorghiu
- Parameters:
- {Array} m
- - the matrix to clone
- Returns:
- {Array} - the clone of orriginal matrix
<static>
{Boolean}
Matrix.equals(m1, m2)
Compares two matrixes
- Parameters:
- {Array} m1
- - first matrix
- {Array} m2
- - second matrix
- Returns:
- {Boolean} true if matrixes are equal , false otherwise
<static>
{Array}
Matrix.multiply(m1, m2)
Multiply matrix m2 with m1
- Parameters:
- {Array} m1
- - first matrix
- {Array} m2
- - second matrix
- Returns:
- {Array} the multiplication of those 2 matrix
<static>
{Array}
Matrix.rotationMatrix(angle)
Creates a clockwise rotation matrix around the origin.
Note: don't use this to rotate a Figure. You must first move it to origin.
(by using a translation)
- Parameters:
- {Number} angle
- - the angle expressed in radians
- Returns:
- {Array} - the ready to use rotation matrix
- See:
- http://en.wikipedia.org/wiki/Rotation_matrix#In_an_oriented_plane
- http://en.wikipedia.org/wiki/Rotation_matrix
- http://en.wikipedia.org/wiki/Transformation_matrix#Rotation
<static>
{Array}
Matrix.scaleMatrix(sx, sy)
Creates a scale matrix
- Parameters:
- {Number} sx
- - scale factor by which the x will be multiply
- {Number} sy
- - scale factor by which the y will be multiply
- Returns:
- {Array} - the ready to use scale matrix
<static>
{Array}
Matrix.subtract(m1, m2)
Substract matrix m2 from m1
- Parameters:
- {Array} m1
- - first matrix
- {Array} m2
- - second matrix
- Returns:
- {Array} the m1 - m2 matrix
<static>
{Array}
Matrix.translationMatrix(dx, dy)
Creates a translation matrix
- Parameters:
- {Number} dx
- - variation of movement on [Ox axis
- {Number} dy
- - variation of movement on [Oy axis
- Returns:
- {Array} - the ready to use translation matrix