def _rotate_vec_numpy(rx, ry, rz, xyz):
    if ry:
        ca, sa = from_polar(ry)
        zz = xyz[:, 2] * ca - xyz[:, 0] * sa
        xyz[:, 0] = xyz[:, 2] * sa + xyz[:, 0] * ca
        xyz[:, 2] = zz
    if rx:
        ca, sa = from_polar(rx)
        yy = xyz[:, 1] * ca - xyz[:, 2] * sa
        xyz[:, 2] = xyz[:, 1] * sa + xyz[:, 2] * ca
        xyz[:, 1] = yy
    if rz:
        ca, sa = from_polar(rz)
        xx = xyz[:, 0] * ca - xyz[:, 1] * sa
        xyz[:, 1] = xyz[:, 0] * sa + xyz[:, 1] * ca
        xyz[:, 0] = xx
    return xyz
Example #2
0
def _rotate_vec_numpy(rx, ry, rz, xyz):
  if ry:
    ca, sa = from_polar(ry)
    zz = xyz[:,2] * ca - xyz[:,0] * sa
    xyz[:,0] = xyz[:,2] * sa + xyz[:,0] * ca
    xyz[:,2] = zz
  if rx:
    ca, sa = from_polar(rx)
    yy = xyz[:,1] * ca - xyz[:,2] * sa
    xyz[:,2] = xyz[:,1] * sa + xyz[:,2] * ca
    xyz[:,1] = yy
  if rz:
    ca, sa = from_polar(rz)
    xx = xyz[:,0] * ca - xyz[:,1] * sa
    xyz[:,1] = xyz[:,0] * sa + xyz[:,1] * ca
    xyz[:,0] = xx
  return xyz
def _rotate_vec_normal(rx, ry, rz, xyz):
    x, y, z = xyz
    if ry:
        ca, sa = from_polar(ry)
        zz = z * ca - x * sa
        x = z * sa + x * ca
        z = zz
    if rx:
        ca, sa = from_polar(rx)
        yy = y * ca - z * sa
        z = y * sa + z * ca
        y = yy
    if rz:
        ca, sa = from_polar(rz)
        xx = x * ca - y * sa
        y = x * sa + y * ca
        x = xx
    return x, y, z
Example #4
0
def _rotate_vec_normal(rx, ry, rz, xyz):
  x, y, z = xyz
  if ry:
    ca, sa = from_polar(ry)
    zz = z * ca - x * sa
    x = z * sa + x * ca
    z = zz
  if rx:
    ca, sa = from_polar(rx)
    yy = y * ca - z * sa
    z = y * sa + z * ca
    y = yy
  if rz:
    ca, sa = from_polar(rz)
    xx = x * ca - y * sa
    y = x * sa + y * ca
    x = xx
  return x, y, z
Example #5
0
def rotate_vec_z(r, xyz):
    ca, sa = from_polar(r)
    return xyz[0] * ca - xyz[1] * sa, xyz[0] * sa + xyz[1] * ca, xyz[2]
Example #6
0
def rotate_vec_z(r, xyz):
  ca, sa = from_polar(r)
  return xyz[0] * ca - xyz[1] * sa, xyz[0] * sa + xyz[1] * ca, xyz[2]
Example #7
0
def rotate_vec_z(r,x,y,z):
  ca, sa = from_polar(r)
  return x * ca - y * sa, x * sa + y * ca, z
Example #8
0
def rotate_vec_y(r, x, y, z):
  ca, sa = from_polar(r)
  return z * sa + x * ca, y, z * ca - x * sa
Example #9
0
def rotate_vec_x(r, x, y, z):
  ca, sa = from_polar(r)
  return x, y * ca - z * sa, y * sa + z * ca