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 fromprojection_matrixif it is provided.projection_matrix (
MutableDenseMatrix) – The matrix used for projecting the placement of vertices. The matrix must have dimensions(proj_dim, dim), wheredimis the dimension of the given framework. IfNone, 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:
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 factorinplace (
bool) – IfTrue(default), then this framework is translated. Otherwise, a new translated framework is returned.
- Return type:
- pyrigi.framework._transformations.transformations.rotate(framework, **kwargs)[source]¶
Alias for rotating frameworks based on
rotate2D()androtate3D().For implementation details and possible parameters, see
rotate2D()androtate3D().- Return type:
- 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) – IfTrue(default), then this framework is rotated. Otherwise, a new rotated framework is returned.
- Return type:
- 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 thez-axis.axis_shift (
Point) – A point through which the rotation axis passes. By default, this is the origin.inplace (
bool) – IfTrue(default), then this framework is rotated. Otherwise, a new rotated framework is returned.
- Return type:
- pyrigi.framework._transformations.transformations.translate(framework, vector, inplace=True)[source]¶
Translate the framework.
- Parameters:
framework (
FrameworkBase)vector (
Union[Point,MutableDenseMatrix]) – Translation vectorinplace (
bool) – IfTrue(default), then this framework is translated. Otherwise, a new translated framework is returned.
- Return type: