Class: Transform

Transform() → {Transform}

Encapsulates the matrix transformation functionality, meant to work with Renderables

Found in Chapter 3, page 84 of the textbook

Example: 3.3 Transform Objects

Constructor

new Transform() → {Transform}

Source:
Returns:
a new Transform instance
Type
Transform

Methods

cloneTo(aXform)

Clones the attributes of this Transforms to the Transform Arugment
Parameters:
Name Type Description
aXform Transform the Transform object to be cloned into
Source:

get3DPosition() → {vec3}

Returns the three dimensional world coordinate position of this Transform
Source:
Returns:
the x,y,z position of this Transform
Type
vec3

getHeight() → {float}

Returns the height of this Transform
Source:
Returns:
mScale[1] - the height of this Transform
Type
float

getPosition() → {vec2}

Returns the world coordinate position of this Transform
Source:
Returns:
mPosition - the x and y position of this Transform
Type
vec2

getRotationInDegree() → {float}

Returns the width of this Transform in degrees
Source:
Returns:
the rotation of this Transform in degrees
Type
float

getRotationInRad() → {float}

Returns the rotation of this Transform in radians
Source:
Returns:
mRotationInRad - the rotation of this Transform in radians
Type
float

getSize() → {vec2}

Returns the width and height of this Transform
Source:
Returns:
mScale - the width and height of this Transform
Type
vec2

getTRSMatrix() → {mat4}

Returns the matrix of this Transform used to control Renderables
Source:
Returns:
matrix - the translated, rotated, and scaled matrix
Type
mat4

getWidth() → {float}

Returns the width of this Transform
Source:
Returns:
mScale[0] - the width of this Transform
Type
float

getXPos() → {float}

Returns the x world coordinate position of this Transform
Source:
Returns:
mPosition[0] - the x world coordinate position of this Transform
Type
float

getYPos() → {float}

Returns the y world coordinate position of this Transform
Source:
Returns:
mPosition[0] - the y world coordinate position of this Transform
Type
float

getZPos() → {float}

Returns the z world coordinate position of this Transform
Source:
Returns:
mZ - the z world coordinate position of this Transform
Type
float

incHeightBy(delta)

Add a value to the height of this Transform
Parameters:
Name Type Description
delta float the value to be added to the height
Source:

incRotationByDegree(deltaDegree)

Adds deltaDegree to the current rotation value of this Transform
Parameters:
Name Type Description
deltaDegree float value to be added to the rotation, in degrees
Source:

incRotationByRad(deltaRad)

Adds deltaRad to the current rotation value of this Transform
Parameters:
Name Type Description
deltaRad float value to be added to the rotation, in radians
Source:

incSizeBy(delta)

Adds a value to the width and height of this Transform
Parameters:
Name Type Description
delta float the value to be added to both the width and height
Source:

incWidthBy(delta)

Adds a delta to the width
Parameters:
Name Type Description
delta float the value to add
Source:

incXPosBy(delta)

Add a value to the x world coordinate of this Transform
Parameters:
Name Type Description
delta float the value to be added to the current x value
Source:

incYPosBy(delta)

Add a value to the y world coordinate of this Transform
Parameters:
Name Type Description
delta float the value to be added to the current y value
Source:

incZPosBy(delta)

Add a value to the z world coordinate of this Transform
Parameters:
Name Type Description
delta float the value to be added to the current z value
Source:

setHeight(height)

Sets the new height of this Transform
Parameters:
Name Type Description
height float the new height to set for this Transform
Source:

setPosition(xPos, yPos)

Sets the x and y position of this Transform in world coordinates
Parameters:
Name Type Description
xPos float the x position of the Transform
yPos float the y position of the Transform
Source:

setRotationInDegree(rotationInDegree)

Sets the new rotation in degrees of this Transform, internally bounded to [0,360]
Parameters:
Name Type Description
rotationInDegree float the new rotation value for this Transform
Source:

setRotationInRad(rotationInRadians)

Sets the new rotation in radians of this Transform, internally bounded to [0,2*PI]
Parameters:
Name Type Description
rotationInRadians float the new rotation value for this Transform
Source:

setSize(width, height)

Sets the size of this Transform
Parameters:
Name Type Description
width float the new width of this Transform
height float the new height of this Transform
Source:

setWidth(width)

Set the width of this Transform
Parameters:
Name Type Description
width float new width
Source:

setXPos(xPos)

Sets the x world Coordinate of this Tranform
Parameters:
Name Type Description
xPos float the x position to set for this Transform
Source:

setYPos(yPos)

Sets the y world Coordinate of this Tranform
Parameters:
Name Type Description
yPos float the y position to set for this Transform
Source:

setZPos(d)

Sets the z world Coordinate of this Tranform
Parameters:
Name Type Description
d float the z position to set for this Transform
Source: