Summary
Methods
- adjoint(a, out) → {Mat4}
- clone(a) → {Mat4}
- copy(a, out) → {Mat4}
- create() → {Mat4}
- determinant(a) → {Number}
- frob(a) → {Number}
- fromRotation(rad, axis, out) → {Mat4}
- fromRotationTranslation(q, v, out) → {Mat4}
- fromRotationTranslationScale(q, v, s, out) → {Mat4}
- fromRotationTranslationScaleOrigin(q, v, s, o, out) → {Mat4}
- fromScaling(v, out) → {Mat4}
- fromTranslation(v, out) → {Mat4}
- fromXRotation(rad, out) → {Mat4}
- fromYRotation(rad, out) → {Mat4}
- fromZRotation(rad, out) → {Mat4}
- frustum(left, right, bottom, top, near, far, out) → {Mat4}
- identity(out) → {Mat4}
- invert(a, out) → {Mat4}
- lookAt(eye, center, up, out) → {Mat4}
- mul()
- multiply(a, b, out) → {Mat4}
- ortho(left, right, bottom, top, near, far, out) → {Mat4}
- perspective(fovy, aspect, near, far, out) → {Mat4}
- perspectiveFromFieldOfView(fov, near, far, out) → {Mat4}
- rotate(a, rad, axis, out) → {Mat4}
- rotateX(a, rad, out) → {Mat4}
- rotateY(a, rad, out) → {Mat4}
- rotateZ(a, rad, out) → {Mat4}
- scale(a, v, out) → {Mat4}
- str(mat) → {String}
- translate(a, v, out) → {Mat4}
- transpose(a, out) → {Mat4}
Detailed Description
Methods
adjoint(a, out) → {Mat4}
clone(a) → {Mat4}
copy(a, out) → {Mat4}
determinant(a) → {Number}
Calculates the determinant of a mat4
Parameters:
Name | Type | Description |
---|---|---|
a |
Mat4 | the source matrix |
Returns:
determinant of a
- Type
- Number
- Source:
frob(a) → {Number}
Returns Frobenius norm of a mat4
Parameters:
Name | Type | Description |
---|---|---|
a |
Mat4 | the matrix to calculate Frobenius norm of |
Returns:
Frobenius norm
- Type
- Number
- Source:
fromRotation(rad, axis, out) → {Mat4}
Creates a matrix from a given angle around a given axis
This is equivalent to (but much faster than):
mat4.identity(dest);
mat4.rotate(dest, dest, rad, axis);
Parameters:
Name | Type | Description |
---|---|---|
rad |
Number | the angle to rotate the matrix by |
axis |
Vec3 | the axis to rotate around |
out |
Mat4 | mat4 receiving operation result |
Returns:
out
- Type
- Mat4
- Source:
fromRotationTranslation(q, v, out) → {Mat4}
Creates a matrix from a quaternion rotation and vector translation
This is equivalent to (but much faster than):
mat4.identity(dest);
mat4.translate(dest, vec);
var quatMat = mat4.create();
quat4.toMat4(quat, quatMat);
mat4.multiply(dest, quatMat);
Parameters:
Name | Type | Description |
---|---|---|
q |
quat4 | Rotation quaternion |
v |
Vec3 | Translation vector |
out |
Mat4 | mat4 receiving operation result |
Returns:
out
- Type
- Mat4
- Source:
fromRotationTranslationScale(q, v, s, out) → {Mat4}
Creates a matrix from a quaternion rotation, vector translation and vector scale
This is equivalent to (but much faster than):
mat4.identity(dest);
mat4.translate(dest, vec);
var quatMat = mat4.create();
quat4.toMat4(quat, quatMat);
mat4.multiply(dest, quatMat);
mat4.scale(dest, scale)
Parameters:
Name | Type | Description |
---|---|---|
q |
quat4 | Rotation quaternion |
v |
Vec3 | Translation vector |
s |
Vec3 | Scaling vector |
out |
Mat4 | mat4 receiving operation result |
Returns:
out
- Type
- Mat4
- Source:
fromRotationTranslationScaleOrigin(q, v, s, o, out) → {Mat4}
Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin
This is equivalent to (but much faster than):
mat4.identity(dest);
mat4.translate(dest, vec);
mat4.translate(dest, origin);
var quatMat = mat4.create();
quat4.toMat4(quat, quatMat);
mat4.multiply(dest, quatMat);
mat4.scale(dest, scale)
mat4.translate(dest, negativeOrigin);
Parameters:
Name | Type | Description |
---|---|---|
q |
quat4 | Rotation quaternion |
v |
Vec3 | Translation vector |
s |
Vec3 | Scaling vector |
o |
Vec3 | The origin vector around which to scale and rotate |
out |
Mat4 | mat4 receiving operation result |
Returns:
out
- Type
- Mat4
- Source:
fromScaling(v, out) → {Mat4}
fromTranslation(v, out) → {Mat4}
fromXRotation(rad, out) → {Mat4}
Creates a matrix from the given angle around the X axis
This is equivalent to (but much faster than):
mat4.identity(dest);
mat4.rotateX(dest, dest, rad);
Parameters:
Name | Type | Description |
---|---|---|
rad |
Number | the angle to rotate the matrix by |
out |
Mat4 | mat4 receiving operation result |
Returns:
out
- Type
- Mat4
- Source:
fromYRotation(rad, out) → {Mat4}
Creates a matrix from the given angle around the Y axis
This is equivalent to (but much faster than):
mat4.identity(dest);
mat4.rotateY(dest, dest, rad);
Parameters:
Name | Type | Description |
---|---|---|
rad |
Number | the angle to rotate the matrix by |
out |
Mat4 | mat4 receiving operation result |
Returns:
out
- Type
- Mat4
- Source:
fromZRotation(rad, out) → {Mat4}
Creates a matrix from the given angle around the Z axis
This is equivalent to (but much faster than):
mat4.identity(dest);
mat4.rotateZ(dest, dest, rad);
Parameters:
Name | Type | Description |
---|---|---|
rad |
Number | the angle to rotate the matrix by |
out |
Mat4 | mat4 receiving operation result |
Returns:
out
- Type
- Mat4
- Source:
frustum(left, right, bottom, top, near, far, out) → {Mat4}
Generates a frustum matrix with the given bounds
Parameters:
Name | Type | Description |
---|---|---|
left |
Number | Left bound of the frustum |
right |
Number | Right bound of the frustum |
bottom |
Number | Bottom bound of the frustum |
top |
Number | Top bound of the frustum |
near |
Number | Near bound of the frustum |
far |
Number | Far bound of the frustum |
out |
Mat4 | mat4 frustum matrix will be written into |
Returns:
out
- Type
- Mat4
- Source:
identity(out) → {Mat4}
invert(a, out) → {Mat4}
lookAt(eye, center, up, out) → {Mat4}
mul()
Alias for mat4.multiply
- Source:
multiply(a, b, out) → {Mat4}
ortho(left, right, bottom, top, near, far, out) → {Mat4}
Generates a orthogonal projection matrix with the given bounds
Parameters:
Name | Type | Description |
---|---|---|
left |
number | Left bound of the frustum |
right |
number | Right bound of the frustum |
bottom |
number | Bottom bound of the frustum |
top |
number | Top bound of the frustum |
near |
number | Near bound of the frustum |
far |
number | Far bound of the frustum |
out |
Mat4 | mat4 frustum matrix will be written into |
Returns:
out
- Type
- Mat4
- Source:
perspective(fovy, aspect, near, far, out) → {Mat4}
Generates a perspective projection matrix with the given bounds
Parameters:
Name | Type | Description |
---|---|---|
fovy |
number | Vertical field of view in radians |
aspect |
number | Aspect ratio. typically viewport width/height |
near |
number | Near bound of the frustum |
far |
number | Far bound of the frustum |
out |
Mat4 | mat4 frustum matrix will be written into |
Returns:
out
- Type
- Mat4
- Source:
perspectiveFromFieldOfView(fov, near, far, out) → {Mat4}
Generates a perspective projection matrix with the given field of view.
This is primarily useful for generating projection matrices to be used
with the still experiemental WebVR API.
Parameters:
Name | Type | Description |
---|---|---|
fov |
number | Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees |
near |
number | Near bound of the frustum |
far |
number | Far bound of the frustum |
out |
Mat4 | mat4 frustum matrix will be written into |
Returns:
out
- Type
- Mat4
- Source:
rotate(a, rad, axis, out) → {Mat4}
rotateX(a, rad, out) → {Mat4}
rotateY(a, rad, out) → {Mat4}
rotateZ(a, rad, out) → {Mat4}
scale(a, v, out) → {Mat4}
str(mat) → {String}
Returns a string representation of a mat4
Parameters:
Name | Type | Description |
---|---|---|
mat |
Mat4 | matrix to represent as a string |
Returns:
string representation of the matrix
- Type
- String
- Source: