Skip to main content
`Ctrl`+`K`

# vispy.visuals.transforms.base_transform module

API Issues to work out:

> - MatrixTransform and STTransform both have ‘scale’ and ‘translate’ attributes, but they are used in very different ways. It would be nice to keep this consistent, but how?

> - Need a transform.map_rect function that returns the bounding rectangle of a rect after transformation. Non-linear transforms might need to work harder at this, but we can provide a default implementation that works by mapping a selection of points across a grid within the original rect.

class vispy.visuals.transforms.base_transform.BaseTransform

  Bases: `object`

  BaseTransform is a base class that defines a pair of complementary coordinate mapping functions in both python and GLSL.

  All BaseTransform subclasses define map() and imap() methods that map an object through the forward or inverse transformation, respectively.

  The two class variables glsl_map and glsl_imap are instances of shaders.Function that define the forward- and inverse-mapping GLSL function code.

  Optionally, an inverse() method returns a new transform performing the inverse mapping.

  Note that although all classes should define both map() and imap(), it is not necessarily the case that imap(map(x)) == x; there may be instances where the inverse mapping is ambiguous or otherwise meaningless.

  Isometric = None
  Linear = None
  NonScaling = None
  Orthogonal = None
  property dynamic

    Boolean flag that indicates whether this transform is expected to change frequently.

    Transforms that are flagged as dynamic will not be collapsed in `ChainTransform.simplified`. This allows changes to the transform to propagate through the chain without requiring the chain to be re-simplified.

  glsl_imap = None
  glsl_map = None
  imap(obj)

    Return obj mapped through the inverse transformation.

    Parameters:
      obj tuple (x,y) or (x,y,z)

        array with shape (…, 2) or (…, 3)

  property inverse

    The inverse of this transform.

  map(obj)

    Return obj mapped through the forward transformation.

    Parameters:
      obj tuple (x,y) or (x,y,z)

        array with shape (…, 2) or (…, 3)

  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.

  update(*args)

    Called to inform any listeners that this transform has changed.

class vispy.visuals.transforms.base_transform.InverseTransform(transform)

  Bases: `BaseTransform`

  property Isometric

    The type of the None singleton.

  property Linear

    The type of the None singleton.

  property NonScaling

    The type of the None singleton.

  property Orthogonal

    The type of the None singleton.

  property shader_imap

    See shader_map.

  property 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.