Transformations

This module provides transformations of frameworks.

pyrigi.framework._transformations.transformations.projected_realization(framework, proj_dim=None, projection_matrix=None, random_seed=None, coordinates=None)[source]

Return the realization projected to a lower dimension and the projection matrix.

Parameters:
  • framework (FrameworkBase)

  • proj_dim (int) – The dimension to which the framework is projected. This is determined from projection_matrix if it is provided.

  • projection_matrix (MutableDenseMatrix) – The matrix used for projecting the placement of vertices. The matrix must have dimensions (proj_dim, dim), where dim is the dimension of the given framework. If None, a numerical random projection matrix is generated.

  • random_seed (int) – The random seed used for generating the projection matrix.

  • coordinates (Sequence[int]) – Indices of coordinates to which projection is applied. Providing the parameter overrides the previous ones.

Return type:

tuple[dict[Vertex, Point], MutableDenseMatrix]

Suggested Improvements

Generate random projection matrix over symbolic rationals.

pyrigi.framework._transformations.transformations.rescale(framework, factor, inplace=True)[source]

Scale the framework.

Parameters:
  • framework (FrameworkBase)

  • factor (Number) – Scaling factor

  • inplace (bool) – If True (default), then this framework is translated. Otherwise, a new translated framework is returned.

Return type:

None | FrameworkBase

pyrigi.framework._transformations.transformations.rotate(framework, **kwargs)[source]

Alias for rotating frameworks based on rotate2D() and rotate3D().

For implementation details and possible parameters, see rotate2D() and rotate3D().

Return type:

None | FrameworkBase

Parameters:

framework (FrameworkBase)

pyrigi.framework._transformations.transformations.rotate2D(framework, angle, rotation_center=[0, 0], inplace=True)[source]

Rotate the planar framework counterclockwise.

Parameters:
  • framework (FrameworkBase)

  • angle (float) – Rotation angle. If you want the coordinates to stay symbolic even after the rotation, you need to input the angle as a sympy expression.

  • rotation_center (Point) – The center of rotation. By default, this is the origin.

  • inplace (bool) – If True (default), then this framework is rotated. Otherwise, a new rotated framework is returned.

Return type:

None | FrameworkBase

pyrigi.framework._transformations.transformations.rotate3D(framework, angle, axis_direction=[0, 0, 1], axis_shift=[0, 0, 0], inplace=True)[source]

Rotate the spatial framework counterclockwise around a specified rotation axis.

Parameters:
  • framework (FrameworkBase)

  • angle (Number) – Rotation angle around the axis of rotation. If you want the coordinates to stay symbolic even after the rotation, you need to input the angle as a sympy expression.

  • axis_direction (Sequence[Number]) – Direction of the rotation axis. By default, this is the z-axis.

  • axis_shift (Point) – A point through which the rotation axis passes. By default, this is the origin.

  • inplace (bool) – If True (default), then this framework is rotated. Otherwise, a new rotated framework is returned.

Return type:

None | FrameworkBase

pyrigi.framework._transformations.transformations.translate(framework, vector, inplace=True)[source]

Translate the framework.

Parameters:
  • framework (FrameworkBase)

  • vector (Union[Point, MutableDenseMatrix]) – Translation vector

  • inplace (bool) – If True (default), then this framework is translated. Otherwise, a new translated framework is returned.

Return type:

None | FrameworkBase