def RotatePoint3(p, v1, v2): """ Return the input point rotated around the cross of the input vectors. The amount to rotate is the angle between the two vectors. """ v1 = pm.Vec3(v1) v2 = pm.Vec3(v2) v1.normalize() v2.normalize() cross = v1.cross(v2) cross.normalize() if cross.length(): a = v1.angleDeg(v2) quat = pm.Quat() quat.setFromAxisAngle(a, cross) p = quat.xform(p) return p