# MatrixStack

## Object Hierarchy:

## Description:

public class **MatrixStack** :

Object
Tracks your current position within a hierarchy and lets you build up a graph of transformations as you traverse through a hierarchy such
as a scenegraph.

A MatrixStack always maintains a reference to a single transformation at any point in time, representing the
transformation at the current position in the hierarchy. You can get a reference to the current transformation by calling
get_entry.

When a MatrixStack is first created with
MatrixStack then it is conceptually positioned at the root of your hierarchy and the current transformation simply represents an
identity transformation.

As you traverse your object hierarchy (your scenegraph) then you should call push
whenever you move down one level and call pop whenever you move back up one level
towards the root.

At any time you can apply a set of operations, such as "rotate", "scale", "translate" on top of the current transformation of a
MatrixStack using functions such as rotate,
scale and translate.
These operations will derive a new current transformation and will never affect a transformation that you have referenced using
get_entry.

Internally applying operations to a MatrixStack builds up a graph of
MatrixEntry structures which each represent a single immutable transform.

## Content:

### Creation methods:

### Methods:

- public void
**frustum** (float left, float right, float bottom, float top, float z_near, float z_far)
Replaces the current matrix with a perspective matrix for a given
viewing frustum defined by 4 side clip planes that all cross through the origin and 2 near and far clip planes.

- public Matrix?
**@get** (out Matrix matrix)
Resolves the current this transform
into a Matrix by combining the operations that have been applied to build up the current
transform.
- public weak MatrixEntry
**get_entry** ()
Gets a reference to the current transform represented by a
MatrixEntry pointer.
- public Bool
**get_inverse** (out Matrix inverse)
Gets the inverse transform of the current matrix and uses it to
initialize a new Matrix.
- public void
**load_identity** ()
Resets the current matrix to the identity matrix.

- public void
**multiply** (Matrix matrix)
Multiplies the current matrix by the given matrix.

- public void
**orthographic** (float x_1, float y_1, float x_2, float y_2, float near, float far)
Replaces the current matrix with an orthographic projection matrix.

- public void
**perspective** (float fov_y, float aspect, float z_near, float z_far)
Replaces the current matrix with a perspective matrix based on the
provided values.

- public void
**pop** ()
Restores the previous transform that was last saved by calling
push.
- public void
**push** ()
Saves the current transform and starts a new transform that derives
from the current transform.

- public void
**rotate** (float angle, float x, float y, float z)
Multiplies the current matrix by one that rotates the around the
axis-vector specified by `x`

, `y`

and `z`

.

- public void
**rotate_euler** (Euler euler)
Multiplies the current matrix by one that rotates according to the
rotation described by `euler`

.

- public void
**rotate_quaternion** (Quaternion quaternion)
Multiplies the current matrix by one that rotates according to the
rotation described by `quaternion`

.

- public void
**scale** (float x, float y, float z)
Multiplies the current matrix by one that scales the x, y and z axes
by the given values.

- public void
**@set** (Matrix matrix)
Replaces the current this matrix
value with the value of `matrix`

.

- public void
**translate** (float x, float y, float z)
Multiplies the current matrix by one that translates along all three
axes according to the given values.

### Inherited Members:

All known members inherited from class Cogl.Object