Menu - Top - Home - Donate to Me

H3DU.MatrixStack

Back to documentation index.

H3DU.MatrixStack()

H3DU.MatrixStack is a class that implements a stack of 4x4 transformation matrices.

When the constructor is called, it will create a stack whose only element is the identity matrix.

This class is considered a supplementary class to the Public Domain HTML 3D Library and is not considered part of that library.

To use this class, you must include the script "extras/matrixstack.js"; the class is not included in the "h3du_min.js" file which makes up the HTML 3D Library. Example:

<script type="text/javascript" src="extras/matrixstack.js"></script>

Methods

H3DU.MatrixStack#frustum(l, r, b, t, n, f)

Modifies the matrix at the top of this stack by multiplying it by a frustum matrix. This method is designed for enabling a right-handed coordinate system.

Parameters

Return Value

This object. (Type: H3DU.MatrixStack)

H3DU.MatrixStack#get()

Gets a copy of the matrix at the top of this stack.

Return Value

. (Type: Array.<number>)

H3DU.MatrixStack#loadIdentity()

Modifies the matrix at the top of this stack by replacing it with the identity matrix.

Return Value

This object. (Type: H3DU.MatrixStack)

H3DU.MatrixStack#loadMatrix(mat)

Modifies the matrix at the top of this stack by replacing it with the given matrix.

Parameters

Return Value

This object. (Type: H3DU.MatrixStack)

H3DU.MatrixStack#loadTransposeMatrix(mat)

Modifies the matrix at the top of this stack by replacing it with the transpose of the given matrix.

Parameters

Return Value

This object. (Type: H3DU.MatrixStack)

H3DU.MatrixStack#lookAt(ex, ey, ez, cx, cy, cz, ux, uy, uz)

Modifies the matrix at the top of this stack by multiplying it by a matrix representing a camera view. This method is designed for enabling a right-handed coordinate system.

Parameters

Return Value

This object. (Type: H3DU.MatrixStack)

H3DU.MatrixStack#multMatrix(mat)

Modifies the matrix at the top of this stack by multiplying it by another matrix. The matrices are multiplied such that the transformations they describe happen in reverse order. For example, if the matrix at the top of the stack describes a translation and the matrix passed to this method describes a scaling, the multiplied matrix will describe the effect of scaling then translation.

Parameters

Return Value

This object. (Type: H3DU.MatrixStack)

H3DU.MatrixStack#multTransposeMatrix(mat)

Deprecated: Use multMatrix(H3DU.Math.mat4transpose(mat)) instead.

Modifies the matrix at the top of this stack by multiplying it by the transpose of another matrix.

Parameters

Return Value

This object. (Type: H3DU.MatrixStack)

H3DU.MatrixStack#ortho(l, r, b, t, n, f)

Modifies the matrix at the top of this stack by multiplying it by an orthographic projection. In this projection, the left clipping plane is parallel to the right clipping plane and the top to the bottom.

This method is designed for enabling a right-handed coordinate system.

Parameters

Return Value

This object. (Type: H3DU.MatrixStack)

H3DU.MatrixStack#ortho2d(l, r, b, t)

Modifies the matrix at the top of this stack by multiplying it by a 2D orthographic projection. This method is designed for enabling a right-handed coordinate system.

Parameters

Return Value

This object. (Type: H3DU.MatrixStack)

H3DU.MatrixStack#perspective(fov, aspect, n, f)

Modifies the matrix at the top of this stack by multiplying it by a matrix that defines a perspective projection.

This method is designed for enabling a right-handed coordinate system.

Parameters

Return Value

This object. (Type: H3DU.MatrixStack)

H3DU.MatrixStack#pickMatrix(wx, wy, ww, wh, vp)

Modifies the matrix at the top of this stack by multiplying it by a matrix that transforms the view to a portion of the viewport.

Parameters

Return Value

This object. (Type: H3DU.MatrixStack)

H3DU.MatrixStack#popMatrix()

Removes the matrix at the top of this stack, making the matrix beneath it the new top matrix. Has no effect if the stack has only one matrix.

Return Value

This object. (Type: H3DU.MatrixStack)

H3DU.MatrixStack#pushMatrix()

Makes a copy of the matrix at the top of this stack and puts the copy on top of the stack.

Return Value

This object. (Type: H3DU.MatrixStack)

H3DU.MatrixStack#rotate(angle, x, y, z)

Modifies the matrix at the top of this stack by multiplying it by a rotation transformation.

Parameters

Return Value

This object. (Type: H3DU.MatrixStack)

H3DU.MatrixStack#scale(x, y, z)

Modifies the matrix at the top of this stack by multiplying it by a scaling transformation.

Parameters

Return Value

This object. (Type: H3DU.MatrixStack)

H3DU.MatrixStack#translate(x, y, z)

Modifies the matrix at the top of this stack by multiplying it by a translation transformation.

Parameters

Return Value

This object. (Type: H3DU.MatrixStack)

Back to documentation index.