Ejemplo n.º 1
0
    def __init__(self, transform=None, rz=0, ry=0, rx=0, scale=1,
            translation=vector(0,0,0)):
        """
        Construct an affine transform.

        A generic transformation matrix can be supplied, or a transform
        composed of rotation and scaling can be built.

        Generating rotations using supplied Euler angles is performed from the
        perspective of a fixed camera viewing a rotating object, i.e. points
        rotate within a fixed reference frame. Rotations are applied in
        aerospace (ZYX) order.

        @param transform: 3x3 linear transformation matrix.
        @param rx: X rotation angle in radians.
        @param ry: Y rotation angle in radians.
        @param rz: Z rotation angle in radians.
        @param scale: Scaling factor
        @param translation: 3x1 translation vector.
        """
        if transform is not None:
            self._transform = transform
        else:
            self._transform = scale * matrixFromEuler((rz,ry,rx),'zyx',False)

        self._inverseTransform = np.linalg.inv(self._transform)
        self._translation = translation
Ejemplo n.º 2
0
def checkZXY(matrix, euler):
    testing.assert_almost_equal(matrixToEuler(matrix, order='zxy',
        inDegrees=True), euler)
    testing.assert_almost_equal(matrixFromEuler(euler, order='zxy'),
            matrix)