Class Index | File Index

Classes


Class Matrix3


Defined in: lina.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Matrix3(m)
Creates a new 3x3 matrix for transforming in 2d space.
Field Summary
Field Attributes Field Name and Description
 
Defines, if this matrix is non-perspective, i.e.
 
m
Matrix value stored as array of 9 floats.
Method Summary
Method Attributes Method Name and Description
 
copy()
Create and return a copy of this matrix.
 
det()
Calculate the determinant.
 
Invert (in-place) and return this instance.
 
mult(mb)
Apply transformation (in-place) and return this instance.
 
Calculate the vector (dx:0, dy:1) tranformed by this.
 
Reset the current matrix to identity.
 
rotate(a, pt)
Apply rotation (in-place) and return this instance.
 
scale(fx, fy)
Apply scaling (in-place) and return this instance.
 
set(m)
Set the current matrix.
 
Return string representation '[[0, 1, 2], [3, 4, 5], [6, 7, 8]]'.
 
Return transformed x and y as JS-object {x:x', y:y'}.
 
transformVec(dx, dy)
Return transformed dx and dy as JS-object {dx:_, dy:_}.
 
translate(dx, dy)
Apply translation (in-place) and return this instance.
 
Transpose (in-place) and return this instance.
Class Detail
Matrix3(m)
Creates a new 3x3 matrix for transforming in 2d space.
[1  0  0,
 0  1  0,
 Tx Ty 1]

Scale:
[Sx 0  0,
 0  Sy 0,
 0  0  1]

Rotation:
[ c  s 0,
 -s  c 0,
  0  0 1]
Parameters:
{undefined|Matrix3|float[9]} m
Translation:
Field Detail
isAffine
Defines, if this matrix is non-perspective, i.e. the right column is [0, 0, 1] so that m[2] = m[5] = 0 and m[8] = 1. In this case transformations can be processed more efficiently. Default: true.

m
Matrix value stored as array of 9 floats.
Method Detail
copy()
Create and return a copy of this matrix.

{float} det()
Calculate the determinant.
Returns:
{float}

{Matrix3} invert()
Invert (in-place) and return this instance.
Throws:
"Cannot invert", if det(m) == 0
Returns:
{Matrix3}

mult(mb)
Apply transformation (in-place) and return this instance.
Parameters:
mb

{Vec2} orientation()
Calculate the vector (dx:0, dy:1) tranformed by this.
Returns:
{Vec2}

{Matrix3} reset()
Reset the current matrix to identity.
Returns:
{Matrix3}

rotate(a, pt)
Apply rotation (in-place) and return this instance.
Parameters:
a
pt

scale(fx, fy)
Apply scaling (in-place) and return this instance.
Parameters:
fx
fy

{Matrix3} set(m)
Set the current matrix.
Parameters:
{Matrix3|float[9]} m
(optional) defaults to identity matrix [1, 0, 0, 0, 1, 0, 0, 0, 1]
Returns:
{Matrix3}

{string} toString()
Return string representation '[[0, 1, 2], [3, 4, 5], [6, 7, 8]]'.
Returns:
{string}

transformPt(x, y)
Return transformed x and y as JS-object {x:x', y:y'}.
Parameters:
x
y

transformVec(dx, dy)
Return transformed dx and dy as JS-object {dx:_, dy:_}.
Parameters:
dx
dy

translate(dx, dy)
Apply translation (in-place) and return this instance.
Parameters:
dx
dy

transpose()
Transpose (in-place) and return this instance.

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jul 18 2011 14:05:14 GMT+0200 (MESZ)