# pwu::Transform

Utility functions for transform matrices, which are represented as a list of sixteen real values.

Summary
 pwu:: Transform Utility functions for transform matrices, which are represented as a list of sixteen real values. Static Actions identity Return an identity transform matrix set Set an element of a transform matrix element Get an element of a transform matrix apply Transform a vector point matrix by the given transform matrix multiply Multiply one transform matrix by another determinant Return the determinant of a given transform matrix transpose Return the transpose of a given transform matrix inverse Return the inverse of a given transform matrix translate Multiply the given transform matrix by a translation transform translation Return a transform matrix that is a translation of the given offset rotate Multiply the given transform matrix by a rotation transform rotation Return a transform matrix that is a rotation of the given quaternion, axis angle pair, or pair of vectors representing the new X and Y directions. scale Multiply the given transform matrix by a scaling transform scaling Return a transform matrix that is a scaling of the given vector calculatedScaling Return a transform matrix that scales a given point from one location to another anchored at a third point ortho Create an orthonormal view transform matrix from a view frustum perspective Create a perspective view transform matrix from a view frustum mirror Multiply the given transform matrix by a mirroring transform mirroring Return a transform matrix that is a mirroring of the given plane mirrorPlane Return a transform matrix that is a mirroring of the given plane stretch Multiply the given transform matrix by a stretching transform. stretching Return a transform matrix that is a stretching transform.

### identity

 pwu::Transform identity

Return an identity transform matrix

none

#### Returns

a transform that is set to the identity matrix

### set

 pwu::Transform set matrix i j value

Set an element of a transform matrix

#### Parameters

 matrix the transform matrix i the i index of the element to set j the j index of the element to set value the value to set

#### Returns

a transform matrix that is the same as the given transform matrix, except the element that has been set to the given value

### element

 pwu::Transform element matrix i j

Get an element of a transform matrix

#### Parameters

 matrix the transform matrix i the i index of the element to get j the j index of the element to get

#### Returns

the value of the element

### apply

 pwu::Transform apply matrix vec

Transform a vector point matrix by the given transform matrix

#### Parameters

 matrix the transform matrix vec the vector point

#### Returns

the transformed vector point

### multiply

 pwu::Transform multiply matrix1 matrix2

Multiply one transform matrix by another

#### Parameters

 matrix1 the first matrix matrix2 the first matrix

#### Returns

the transform matrix resulting from the multiplication

### determinant

 pwu::Transform determinant matrix

Return the determinant of a given transform matrix

#### Parameters

 matrix the transform matrix

#### Returns

the determinant of the matrix

### transpose

 pwu::Transform transpose matrix

Return the transpose of a given transform matrix

#### Parameters

 matrix the transform matrix

#### Returns

the transform matrix resulting from the transposition

### inverse

 pwu::Transform inverse matrix

Return the inverse of a given transform matrix

#### Parameters

 matrix the transform matrix

#### Returns

the transform matrix resulting from the inversion

### translate

 pwu::Transform translate matrix offset

Multiply the given transform matrix by a translation transform

#### Parameters

 matrix thetransform matrix offset the translation transform offset vector

#### Returns

the transform matrix multiplied by the translation transform

### translation

 pwu::Transform translation offset

Return a transform matrix that is a translation of the given offset

#### Parameters

 offset the translation transform offset

#### Returns

the translation transform

### rotate

 pwu::Transform rotate ?-anchor anchor_pt? matrix axis angle

Multiply the given transform matrix by a rotation transform

#### Parameters

 anchor_pt the point about which the matrix is rotated (default is the origin) matrix the transform matrix axis the rotation transform axis vector angle the rotation transform angle

#### Returns

the matrix multiplied by the rotation transform

### rotation

 pwu::Transform rotation ?-anchor anchor_pt? < quat | axis angle | right up >

Return a transform matrix that is a rotation of the given quaternion, axis angle pair, or pair of vectors representing the new X and Y directions.

#### Parameters

 anchor_pt This is the point about which the matrix is rotated (default is the origin). quat This argument represents the rotation quaternion. axis This argument is the axis of rotation and is used in conjuction with the angle argument. angle This argument is angle of rotation about the axis argument. right This represents the direction to which the X axis is rotated by the rotation matrix.  The value is normalized before use. up This represents the direction to which the Y axis is rotated by the rotation matrix.  Note that it normalized and made orthogonal to the right vector.  An error is reported if it is parallel to the right vector.

#### Returns

This action returns a rotation matrix.

### scale

 pwu::Transform scale ?-anchor anchor_pt? matrix scale

Multiply the given transform matrix by a scaling transform

#### Parameters

 anchor_pt the point about which the matrix is scaled (default is the origin) matrix the transform matrix scale the scaling matrix vector

#### Returns

the matrix multiplied by the scaling matrix

### scaling

 pwu::Transform scaling ?-anchor anchor_pt? scale_vec

Return a transform matrix that is a scaling of the given vector

#### Parameters

 anchor_pt the point about which the matrix is scaled (default is the origin) scale the scaling vector

#### Returns

the scaling matrix

### calculatedScaling

Return a transform matrix that scales a given point from one location to another anchored at a third point

#### Parameters

 anchor the anchor for the scaling (a point at this location will not be transformed by the matrix) start a point value representing a location before transformation end a point value representing the start value’s location after transformation tol if a component of the vector difference between the anchor and start point is less than the specified tolerance, the scaling factor will be set to 1 for that component (default value is zero)

#### Returns

the scaling matrix

### ortho

 pwu::Transform ortho left right bottom top near far

Create an orthonormal view transform matrix from a view frustum

#### Parameters

 left the left plane constant right the right plane constant bottom the bottom plane constant top the top plane constant near the near plane constant far the far plane constant

#### Returns

the view transform matrix

### perspective

 pwu::Transform perspective left right bottom top near far

Create a perspective view transform matrix from a view frustum

#### Parameters

 left the left plane constant right the right plane constant bottom the bottom plane constant top the top plane constant near the near plane constant far the far plane constant

#### Returns

the view transform matrix

### mirror

 pwu::Transform mirror matrix normal dist

Multiply the given transform matrix by a mirroring transform

#### Parameters

 matrix the transform matrix normal the normal of the mirroring plane dist the constant value of the plane

#### Returns

the matrix multiplied by the mirroring matrix

### mirroring

 pwu::Transform mirroring normal dist

Return a transform matrix that is a mirroring of the given plane

#### Parameters

 normal the normal of the mirroring plane dist the constant value of the plane

#### Returns

the mirroring matrix

### mirrorPlane

 pwu::Transform mirrorPlane plane

Return a transform matrix that is a mirroring of the given plane

#### Parameters

 plane The mirroring plane.

#### Returns

the mirroring matrix

### stretch

 pwu::Transform stretch matrix anchor start end

Multiply the given transform matrix by a stretching transform.  If the vector defined by the start and end points is orthogonal to the vector defined by the start and anchor points, the transform is undefined and the matrix will be set to the identity matrix.

#### Parameters

 matrix the transform matrix anchor the anchor for the stretching (a point at this location will not be transformed by the matrix) start a point value representing a location before transformation end a point value representing the start value’s location after transformation

#### Returns

the matrix multiplied by the stretching matrix

### stretching

 pwu::Transform stretching anchor start end

Return a transform matrix that is a stretching transform.  If the vector defined by the start and end points is orthogonal to the vector defined by the start and anchor points, the transform is undefined and the matrix will be set to the identity matrix.

#### Parameters

 anchor the anchor for the scaling (a point at this location will not be transformed by the matrix) start a point value representing a location before transformation end a point value representing the start value’s location after transformation

#### Returns

the stretching matrix

 pwu::Transform identity
Return an identity transform matrix
 pwu::Transform set matrix i j value
Set an element of a transform matrix
 pwu::Transform element matrix i j
Get an element of a transform matrix
 pwu::Transform apply matrix vec
Transform a vector point matrix by the given transform matrix
 pwu::Transform multiply matrix1 matrix2
Multiply one transform matrix by another
 pwu::Transform determinant matrix
Return the determinant of a given transform matrix
 pwu::Transform transpose matrix
Return the transpose of a given transform matrix
 pwu::Transform inverse matrix
Return the inverse of a given transform matrix
 pwu::Transform translate matrix offset
Multiply the given transform matrix by a translation transform
 pwu::Transform translation offset
Return a transform matrix that is a translation of the given offset
 pwu::Transform rotate ?-anchor anchor_pt? matrix axis angle
Multiply the given transform matrix by a rotation transform
 pwu::Transform rotation ?-anchor anchor_pt? < quat | axis angle | right up >
Return a transform matrix that is a rotation of the given quaternion, axis angle pair, or pair of vectors representing the new X and Y directions.
 pwu::Transform scale ?-anchor anchor_pt? matrix scale
Multiply the given transform matrix by a scaling transform
 pwu::Transform scaling ?-anchor anchor_pt? scale_vec
Return a transform matrix that is a scaling of the given vector
 pwu::Transform ortho left right bottom top near far
Create an orthonormal view transform matrix from a view frustum
 pwu::Transform perspective left right bottom top near far
Create a perspective view transform matrix from a view frustum
 pwu::Transform mirror matrix normal dist
Multiply the given transform matrix by a mirroring transform
 pwu::Transform mirroring normal dist
Return a transform matrix that is a mirroring of the given plane
 pwu::Transform mirrorPlane plane
Return a transform matrix that is a mirroring of the given plane
 pwu::Transform stretch matrix anchor start end
Multiply the given transform matrix by a stretching transform.
 pwu::Transform stretching anchor start end
Return a transform matrix that is a stretching transform.