transform

class guerilla.transform

Bases: object

A transform is a set of matrices placed in time at inter-frames

addmatrix(source, time)

Add a matrix and its time at the end of the transform

Parameters:
  • source (matrix) – the matrix to add
  • time (number) – the time associated
compose(right)

Right compose by another transform. The result may be inccaurate if the final number of matrices is above 6.

Parameters:right (transform) – the transform to compose on the right
copy(*args)

copy a transform into this transform

Available arguments:

Parameters:source (transform) – the source transform
Return type:transform

or

Parameters:source (matrix) – the source matrix
Return type:transform
createcompose(first, second)

Create the compose transform of first times second

Parameters:
Return type:

transform

createinverted()

Create the transform inserse

Return type:transform
getmatrix(index)

return the nth matrix of the transform

Parameters:index (int) – Matrix number to return
Return type:matrix
getstepcount()

Return the number of steps in this transform

gettime(index)

Get the transform time at index

Parameters:index (int) – the index in the transform
Return type:number
invert()

Invert the transform

isidentity()

Returns true if the transform is identity

Returns:True when the transform is identity
Return type:bool
serialstring()

Returns a Lua evaluable string to create this object

setmatrix(index, source)

Set the matrix by its index

Parameters:
  • index (int) – the index in the transform
  • source (matrix) – the matrix to set
setscale(scale)

Force the scale of the transform

Parameters:scale (point3 or number) – the scale factor to apply
setscaleafter(scale)

Force the scale of the transform after the rotation component of the transform

Parameters:scale (point3 or number) – the scale factor to apply
settime(index, time)

Set the transform time at index

Parameters:
  • index (int) – the index in the transform
  • time (number) – the time to set
symetric(*args)

Compute the symetric of this transform by a plane defined by a point and a normal vector

Available arguments:

Parameters:
  • P (point3) – The symetry plane point
  • u (point3) – The symetry plane normal vector
Returns:

The resulting symetric transform

Return type:

transform

or

Parameters:
  • s (transform) – The symetry plane tranform
  • axis (str) – The axis of the symetry transform to use as symetry plane normal (“x”, “y” or “z”)
Returns:

The resulting symetric transform

Return type:

transform

transform(source, func)

Copy the transform and apply a function on each matrix of the copy.

This method copies the transform and apply a user function on each of the matrices of the copied transform. The user function takes one matrix as argument, and modifies directly this matrix.

Parameters:
  • source (transform) – the transform to transform
  • func (function) – the user function to apply on each matrix of the transform
Returns:

The resulting transform

Return type:

transform

translate(translation)

Translate a transform, all matrices are translated

Parameters:translation (point3) – the translation