vispy.visuals.transforms.chain module

class vispy.visuals.transforms.chain.ChainTransform(*transforms)

Bases: vispy.visuals.transforms.base_transform.BaseTransform

BaseTransform subclass that performs a sequence of transformations in order. Internally, this class uses shaders.FunctionChain to generate its glsl_map and glsl_imap functions.

Parameters
transformslist of BaseTransform instances

See transforms property.

property Isometric
property Linear
property NonScaling
property Orthogonal
append(tr)

Add a new transform to the end of this chain.

Parameters
trinstance of Transform

The transform to use.

glsl_imap = None
glsl_map = None
imap(coords)

Inverse map coordinates

Parameters
coordsarray-like

Coordinates to inverse map.

Returns
coordsndarray

Coordinates.

map(coords)

Map coordinates

Parameters
coordsarray-like

Coordinates to map.

Returns
coordsndarray

Coordinates.

prepend(tr)

Add a new transform to the beginning of this chain.

Parameters
trinstance of Transform

The transform to use.

shader_imap()

See shader_map.

shader_map()

Return a shader Function that accepts only a single vec4 argument and defines new attributes / uniforms supplying the Function with any static input.

property simplified

A simplified representation of the same transformation.

property transforms

The list of transform that make up the transform chain.

The order of transforms is given such that the last transform in the list is the first to be invoked when mapping coordinates through the chain.

For example, the following two mappings are equivalent:

# Map coordinates through individual transforms:
trans1 = STTransform(scale=(2, 3), translate=(0, 1))
trans2 = PolarTransform()
mapped = trans1.map(trans2.map(coords))

# Equivalent mapping through chain:
chain = ChainTransform([trans1, trans2])
mapped = chain.map(coords)
class vispy.visuals.transforms.chain.SimplifiedChainTransform(chain)

Bases: vispy.visuals.transforms.chain.ChainTransform

source_changed(event)

Generate a simplified chain by joining adjacent transforms.