Skip to content

TransformationStack

Canonical path: Utils.Geometry.TransformationStack.TransformationStack

implementation of the transformation stack

Methods:

  • __getitem__

    get a transformation matrix from the stack

  • __init__

    initialize

  • append

    append a transformation matrix to the stack

  • pop

    pop the last transformation matrix from the stack

  • restore

    restore a transformation

  • restore_all

    restore all transformations

  • restore_stack

    restore the stack

  • rotate_x

    add a rotation around the x axis to the stack

  • rotate_y

    add a rotation around the y axis to the stack

  • rotate_z

    add a rotation around the z axis to the stack

  • save_stack

    save and clear the stack

  • scale

    add a scaling to the stack

  • scale_x

    add a x scaling to the stack

  • scale_xy

    add a x/y scaling to the stack

  • scale_y

    add a y scaling to the stack

  • scale_z

    add a z scaling to the stack

  • transform

    transform a geometry element with the current transformation matrix

  • translate

    add a vector translation to the stack

  • translate_x

    add a x translation to the stack

  • translate_xy

    add a x/y translation to the stack

  • translate_xyz

    add a x/y/z translation to the stack

  • translate_y

    add a y translation to the stack

  • translate_z

    add a z translation to the stack

Attributes:

length_fac property

length_fac: float

get the length factor

Returns:

  • float

    length factor

trans_matrix property

trans_matrix: Matrix3D

get the current transformation matrix

Returns:

  • Matrix3D

    current transformation matrix

__getitem__

__getitem__(pos: int) -> Matrix3D

get a transformation matrix from the stack

Parameters:

  • pos (int) –

    index of the transformation matrix

Returns:

  • Matrix3D

    transformation matrix at the given index

__init__

__init__(length_unit: LengthUnit = MM, angle_unit: AngleUnit = DEGREE)

initialize

Parameters:

append

append(matrix: Matrix3D)

append a transformation matrix to the stack

Parameters:

  • matrix (Matrix3D) –

    matrix to append

pop

pop(pos: int = -1) -> Matrix3D

pop the last transformation matrix from the stack

Parameters:

  • pos (int, default: -1 ) –

    index of the transformation matrix to pop, -1 for the last one

Returns:

restore

restore(count: int)

restore a transformation

Parameters:

  • count (int) –

    description

restore_all

restore_all()

restore all transformations

restore_stack

restore_stack()

restore the stack

rotate_x

rotate_x(angle: float | Angle, axis_point: Point2D | Point3D = Point3D())

add a rotation around the x axis to the stack

Parameters:

  • angle (float | Angle) –

    rotation angle in the defined angle unit

  • axis_point (Point2D | Point3D, default: Point3D() ) –

    axis point (optional, default is the origin)

rotate_y

rotate_y(angle: float | Angle, axis_point: Point2D | Point3D = Point3D())

add a rotation around the y axis to the stack

Parameters:

  • angle (float | Angle) –

    rotation angle in the defined angle unit

  • axis_point (Point2D | Point3D, default: Point3D() ) –

    axis point

rotate_z

rotate_z(angle: float | Angle, axis_point: Point2D | Point3D = Point3D())

add a rotation around the z axis to the stack

Parameters:

  • angle (float | Angle) –

    rotation angle in the defined angle unit

  • axis_point (Point2D | Point3D, default: Point3D() ) –

    axis point

save_stack

save_stack()

save and clear the stack

scale

scale(x_fac: float, y_fac: float, z_fac: float)

add a scaling to the stack

Parameters:

  • x_fac (float) –

    scale factor in x direction

  • y_fac (float) –

    scale factor in y direction

  • z_fac (float) –

    scale factor in z direction

scale_x

scale_x(x_fac: float)

add a x scaling to the stack

Parameters:

  • x_fac (float) –

    scale factor in x direction

scale_xy

scale_xy(x_fac: float, y_fac: float)

add a x/y scaling to the stack

Parameters:

  • x_fac (float) –

    scale factor in x direction

  • y_fac (float) –

    scale factor in y direction

scale_y

scale_y(y_fac: float)

add a y scaling to the stack

Parameters:

  • y_fac (float) –

    scale factor in y direction

scale_z

scale_z(z_fac: float)

add a z scaling to the stack

Parameters:

  • z_fac (float) –

    scale factor in z direction

transform

transform(geo_ele: Any) -> Any

transform a geometry element with the current transformation matrix

Parameters:

  • geo_ele (Any) –

    geometry element to transform

Returns:

  • Any

    transformed geometry element

translate

translate(vec: Vector3D)

add a vector translation to the stack

Parameters:

translate_x

translate_x(vec_x: float)

add a x translation to the stack

Parameters:

  • vec_x (float) –

    x translation

translate_xy

translate_xy(vec_x: float, vec_y: float)

add a x/y translation to the stack

Parameters:

  • vec_x (float) –

    x translation

  • vec_y (float) –

    y translation

translate_xyz

translate_xyz(vec_x: float, vec_y: float, vec_z: float)

add a x/y/z translation to the stack

Parameters:

  • vec_x (float) –

    x translation

  • vec_y (float) –

    y translation

  • vec_z (float) –

    z translation

translate_y

translate_y(vec_y: float)

add a y translation to the stack

Parameters:

  • vec_y (float) –

    y translation

translate_z

translate_z(vec_z: float)

add a z translation to the stack

Parameters:

  • vec_z (float) –

    z translation

Placeholder