knots.transforms.KnotTransform#

class knots.transforms.KnotTransform(matrix=None, **kwargs)[source]#

Bases: Affine2D

__init__(matrix=None, **kwargs)#

Initialize an Affine transform from a 3x3 numpy float array:

a c e
b d f
0 0 1

If matrix is None, initialize with the identity transform.

Methods

__init__([matrix])

Initialize an Affine transform from a 3x3 numpy float array.

clear()

Reset the underlying matrix to the identity transform.

contains_branch(other)

Return whether the given transform is a sub-tree of this transform.

contains_branch_seperately(other_transform)

Return whether the given branch is a sub-tree of this transform on each separate dimension.

from_values(a, b, c, d, e, f)

Create a new Affine2D instance from the given values.

frozen()

Return a frozen copy of this transform node.

get_affine()

Get the affine part of this transform.

get_matrix()

Get the underlying transformation matrix as a 3x3 array.

invalidate()

Invalidate this TransformNode and triggers an invalidation of its ancestors.

inverted()

Return the corresponding inverse transformation.

reflect(theta)

Add a rotation (in radians) to this transform in place.

reflect_deg(degrees)

Add a rotation (in degrees) to this transform in place.

rotate(theta)

Add a rotation (in radians) to this transform in place.

rotate_around(x, y, theta)

Add a rotation (in radians) around the point (x, y) in place.

rotate_deg(degrees)

Add a rotation (in degrees) to this transform in place.

rotate_deg_around(x, y, degrees)

Add a rotation (in degrees) around the point (x, y) in place.

scale(sx[, sy])

Add a scale in place.

set(other)

Set this transformation from the frozen copy of another Affine2DBase object.

set_children(*children)

Set the children of the transform, to let the invalidation system know which transforms can invalidate this transform.

set_matrix(mtx)

Set the underlying transformation matrix from a 3x3 array.

skew(xShear, yShear)

Add a skew in place.

skew_deg(xShear, yShear)

Add a skew in place.

to_values()

Return the values of the matrix as an (a, b, c, d, e, f) tuple.

transform(values)

Apply this transformation on the given array of values.

transform_affine(values)

Apply only the affine part of this transformation on the given array of values.

transform_angles(angles, pts[, radians, pushoff])

Transform a set of angles anchored at specific locations.

transform_bbox(bbox)

Transform the given bounding box.

transform_non_affine(values)

Apply only the non-affine part of this transformation.

transform_path(path)

Apply the transform to Path path, returning a new Path.

transform_path_affine(path)

Apply the affine part of this transform to Path path, returning a new Path.

transform_path_non_affine(path)

Apply the non-affine part of this transform to Path path, returning a new Path.

transform_point(point)

Return a transformed point.

translate(tx, ty)

Add a translation in place.

Attributes

depth

Return the number of transforms which have been chained together to form this Transform instance.

has_inverse

True if this transform has a corresponding inverse transform.

input_dims

The number of input dimensions of this transform.

is_affine

is_bbox

is_separable

bool(x) -> bool

output_dims

The number of output dimensions of this transform.

pass_through

If pass_through is True, all ancestors will always be invalidated, even if 'self' is already invalid.

reflect(theta)[source]#

Add a rotation (in radians) to this transform in place.

Returns self, so this method can easily be chained with more calls to rotate(), rotate_deg(), translate() and scale().

reflect_deg(degrees)[source]#

Add a rotation (in degrees) to this transform in place.

Returns self, so this method can easily be chained with more calls to rotate(), rotate_deg(), translate() and scale().