def __call__()

in jsuarez/extra/embyr_deprecated/embyr/oldtrans.py [0:0]


    def __call__(self, vec):
        x = (self.x + self.xVol) / sz
        y = (self.y + self.yVol) / sz
        yclip = np.clip(y, -pi/2, 0)

        xz_x = np.cos(x)
        xz_z = np.sin(x)

        yz_y = np.cos(yclip)
        yz_z = np.sin(yclip)

        xz = np.array([
            [xz_x, 0, -xz_z],
            [0   , 1,  0   ],
            [xz_z, 0,  xz_x]])

        yz = np.array([
            [1, 0,    0    ],
            [0, yz_y, -yz_z],
            [0, yz_z, yz_y]])

        #Find cylindrical xz plane rotation
        rot_xz = rad*np.dot(xz, vec)
        xx, _, zz = rot_xz
        xz_vec = np.array([xx, 0, zz])

        #Find spherical yz plane rotation
        _, yy, zn = np.dot(yz, vec)
        xz_norm = zn

        #For x, z: shrink to position of spherical rotation
        #For y: use height from spherical rotation
        vec = np.array([xx*xz_norm, -rad*yy, zz*xz_norm])
        return rot_xz, xz_vec, xz_norm, vec