def __call__()

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


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

        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
        xx, _, zz = np.dot(xz, pos - vec)

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

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