vispy.util.transforms module

Very simple transformation library that is needed for some examples.

vispy.util.transforms.affine_map(points1, points2)[source]

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)[source]

Create view frustum

Parameters
leftfloat

Left coordinate of the field of view.

rightfloat

Right coordinate of the field of view.

bottomfloat

Bottom coordinate of the field of view.

topfloat

Top coordinate of the field of view.

znearfloat

Near coordinate of the field of view.

zfarfloat

Far coordinate of the field of view.

Returns
Mndarray

View frustum matrix (4x4).

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

Create orthographic projection matrix

Parameters
leftfloat

Left coordinate of the field of view.

rightfloat

Right coordinate of the field of view.

bottomfloat

Bottom coordinate of the field of view.

topfloat

Top coordinate of the field of view.

znearfloat

Near coordinate of the field of view.

zfarfloat

Far coordinate of the field of view.

Returns
Mndarray

Orthographic projection matrix (4x4).

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

Create perspective projection matrix

Parameters
fovyfloat

The field of view along the y axis.

aspectfloat

Aspect ratio of the view.

znearfloat

Near coordinate of the field of view.

zfarfloat

Far coordinate of the field of view.

Returns
Mndarray

Perspective projection matrix (4x4).

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

The 3x3 rotation matrix for rotation about a vector.

Parameters
anglefloat

The angle of rotation, in degrees.

axisndarray

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

Returns
Mndarray

Transformation matrix describing the rotation.

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

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

Parameters
sarray-like, shape (3,)

Scaling in x, y, z.

dtypedtype | None

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

Returns
Mndarray

Transformation matrix describing the scaling.

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

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

Parameters
offsetarray-like, shape (3,)

Translation in x, y, z.

dtypedtype | None

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

Returns
Mndarray

Transformation matrix describing the translation.