Skip to content

skais_mapper.rotations

Rotation operators for point cloud arrays.

Classes:

Name Description
R

Class of rotation operators.

R

R(omega: np.ndarray | None = None)

Class of rotation operators.

Initialize rotator object.

Parameters:

Name Type Description Default
omega np.ndarray | None

Rotation angle in

None

Methods:

Name Description
__call__

Rotate the input according to this rotation operator.

x

Rotation operator about the current x-axis by angle theta.

y

Rotation operator about the current y-axis by angle theta.

z

Rotation operator about the current z-axis by angle theta.

Source code in skais_mapper/rotations.py
16
17
18
19
20
21
22
def __init__(self, omega: np.ndarray | None = None):
    """Initialize rotator object.

    Args:
        omega: Rotation angle in
    """
    self.omega = omega

__call__

__call__(arr: np.ndarray, **kwargs) -> np.ndarray

Rotate the input according to this rotation operator.

Parameters:

Name Type Description Default
arr np.ndarray

The array to be rotated

required
kwargs

Dummy keyword arguments

{}

Returns:

Name Type Description
arr np.ndarray

The rotated array

Source code in skais_mapper/rotations.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
def __call__(self, arr: np.ndarray, **kwargs) -> np.ndarray:
    """Rotate the input according to this rotation operator.

    Args:
        arr: The array to be rotated
        kwargs: Dummy keyword arguments

    Returns:
        arr: The rotated array
    """
    if self.omega is None:
        self.omega = self._x(0)
    arr = arr @ self.omega.transpose()
    return arr

x classmethod

x(theta: float, degrees: bool = True) -> TRotation

Rotation operator about the current x-axis by angle theta.

Parameters:

Name Type Description Default
theta float

Rotation angle in degrees or radians (see below)

required
degrees bool

Rotation in degrees, if false in radians

True
Source code in skais_mapper/rotations.py
50
51
52
53
54
55
56
57
58
59
@classmethod
def x(cls, theta: float, degrees: bool = True) -> TRotation:
    """Rotation operator about the current x-axis by angle theta.

    Args:
        theta: Rotation angle in degrees or radians (see below)
        degrees: Rotation in degrees, if false in radians
    """
    omega = cls._x(theta, degrees=degrees)
    return cls(omega)

y classmethod

y(theta: float, degrees: bool = True) -> TRotation

Rotation operator about the current y-axis by angle theta.

Parameters:

Name Type Description Default
theta float

Rotation angle in degrees or radians (see below)

required
degrees bool

Rotation in degrees, if false in radians

True
Source code in skais_mapper/rotations.py
61
62
63
64
65
66
67
68
69
70
@classmethod
def y(cls, theta: float, degrees: bool = True) -> TRotation:
    """Rotation operator about the current y-axis by angle theta.

    Args:
        theta: Rotation angle in degrees or radians (see below)
        degrees: Rotation in degrees, if false in radians
    """
    omega = cls._y(theta, degrees=degrees)
    return cls(omega)

z classmethod

z(theta: float, degrees: bool = True) -> TRotation

Rotation operator about the current z-axis by angle theta.

Parameters:

Name Type Description Default
theta float

Rotation angle in degrees or radians (see below)

required
degrees bool

Rotation in degrees, if false in radians

True
Source code in skais_mapper/rotations.py
72
73
74
75
76
77
78
79
80
81
@classmethod
def z(cls, theta: float, degrees: bool = True) -> TRotation:
    """Rotation operator about the current z-axis by angle theta.

    Args:
        theta: Rotation angle in degrees or radians (see below)
        degrees: Rotation in degrees, if false in radians
    """
    omega = cls._z(theta, degrees=degrees)
    return cls(omega)