# vispy.util.transforms module

Very simple transformation library that is needed for some examples.

vispy.util.transforms.affine_map(points1, points2)

  Find a 3D transformation matrix that maps points1 onto points2.

  Arguments are specified as arrays of four 3D coordinates, shape (4, 3).

vispy.util.transforms.frustum(left, right, bottom, top, znear, zfar)

  Create view frustum

  Parameters:
    left float

      Left coordinate of the field of view.

    right float

      Right coordinate of the field of view.

    bottom float

      Bottom coordinate of the field of view.

    top float

      Top coordinate of the field of view.

    znear float

      Near coordinate of the field of view.

    zfar float

      Far coordinate of the field of view.

  Returns:
    M ndarray

      View frustum matrix (4x4).

vispy.util.transforms.ortho(left, right, bottom, top, znear, zfar)

  Create orthographic projection matrix

  Parameters:
    left float

      Left coordinate of the field of view.

    right float

      Right coordinate of the field of view.

    bottom float

      Bottom coordinate of the field of view.

    top float

      Top coordinate of the field of view.

    znear float

      Near coordinate of the field of view.

    zfar float

      Far coordinate of the field of view.

  Returns:
    M ndarray

      Orthographic projection matrix (4x4).

vispy.util.transforms.perspective(fovy, aspect, znear, zfar)

  Create perspective projection matrix

  Parameters:
    fovy float

      The field of view along the y axis.

    aspect float

      Aspect ratio of the view.

    znear float

      Near coordinate of the field of view.

    zfar float

      Far coordinate of the field of view.

  Returns:
    M ndarray

      Perspective projection matrix (4x4).

vispy.util.transforms.rotate(angle, axis, dtype=None)

  The 4x4 rotation matrix for rotation about a vector.

  Parameters:
    angle float

      The angle of rotation, in degrees.

    axis ndarray

      The x, y, z coordinates of the axis direction vector.

  Returns:
    M ndarray

      Transformation matrix describing the rotation.

vispy.util.transforms.scale(s, dtype=None)

  Non-uniform scaling along the x, y, and z axes

  Parameters:
    s array-like, shape (3,)

      Scaling in x, y, z.

    dtype dtype | None

      Output type (if None, don’t cast).

  Returns:
    M ndarray

      Transformation matrix describing the scaling.

vispy.util.transforms.translate(offset, dtype=None)

  Translate by an offset (x, y, z) .

  Parameters:
    offset array-like, shape (3,)

      Translation in x, y, z.

    dtype dtype | None

      Output type (if None, don’t cast).

  Returns:
    M ndarray

      Transformation matrix describing the translation.

previous

vispy.util.quaternion module

next

vispy.util.wrappers module