MatrixStack

Back to documentation index.

### MatrixStack()

This class 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.

Methods

### 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: MatrixStack)

### MatrixStack#get()

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

Return Value

. (Type: Array.<number>)

### MatrixStack#loadIdentity()

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

Return Value

This object. (Type: MatrixStack)

### 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: MatrixStack)

### 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: MatrixStack)

### 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: MatrixStack)

### 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: MatrixStack)

### 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: MatrixStack)

### 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: MatrixStack)

### 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: MatrixStack)

### 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: MatrixStack)

### 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: MatrixStack)

### 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: MatrixStack)

### 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: MatrixStack)

### 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: MatrixStack)

### 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: MatrixStack)

Back to documentation index.