[Input]
  _rhs_ should be Vector3.
 [Output]
  return two vectors angle as Numeric (rad).
323759
def angle(rhs)
      Util3D.check_arg_type(Vector3, rhs)
      vec1Length = self.length ;
      vec2Length = rhs.length   ;
      return 0.0 if(vec1Length*vec2Length < self.tolerance )
      v = self.dot(rhs)/(vec1Length*vec2Length)
      Math::acos( v )
    end
1145612
def rotMatrix2AxisAndAngle(R):
    
    angle = np.arccos((R[0, 0] + R[1, 1] + R[2, 2] - 1)/ 2)
    axis = np.array([
        # x
        (R[2, 1] - R[1, 2])/ np.sqrt((R[2, 1] - R[1, 2])
                                                ** 2 + (R[0, 2] - R[2, 0])**2 + (R[1, 0] - R[0, 1])**2),
        # y
        (R[0, 2] - R[2, 0])/ np.sqrt((R[2, 1] - R[1, 2])
                                                ** 2 + (R[0, 2] - R[2, 0])**2 + (R[1, 0] - R[0, 1])**2),
        # z
        (R[1, 0] - R[0, 1])/ np.sqrt((R[2, 1] - R[1, 2])**2 + 
                                                (R[0, 2] - R[2, 0])**2 + (R[1, 0] - R[0, 1])**2)])
    return axis, angle
812311
def vector_angle(pairs):
    
    pairs = np.asanyarray(pairs, dtype=np.float64)
    if len(pairs) == 0:
        return np.array([])
    elif util.is_shape(pairs, (2, 3)):
        pairs = pairs.reshape((-1, 2, 3))
    elif not util.is_shape(pairs, (-1, 2, (2, 3))):
        raise ValueError('pairs must be (n,2,(2|3))!')

    # do the dot product between vectors
    dots = util.diagonal_dot(pairs[:, 0], pairs[:, 1])
    # clip for floating point error
    dots = np.clip(dots, -1.0, 1.0)
    # do cos and remove arbitrary sign
    angles = np.abs(np.arccos(dots))

    return angles
649609
def _is_trivial_angle(rad: float, atol: float) -> bool:
    
    return abs(rad) < atol or abs(abs(rad) - np.pi / 4) < atol
711667
def angle(vec1, vec2):
    """"""
    dot_vec = dot(vec1, vec2)
    mag1 = vec1.length()
    mag2 = vec2.length()
    result = dot_vec / (mag1 * mag2)
    return math.acos(result)
389812
def sin_3(a=1):
    """

    def lhs(x):
        return x/(a**2 + x**2)

    def rhs(b):
        return np.pi*np.exp(-a*b)/2

    return Ghosh('sin', lhs, rhs)
718958
def _check_R2_axes_asym(self):
        
        for v in self.principal_axes:
            op = SymmOp.from_axis_angle_and_translation(v, 180)
            if self.is_valid_op(op):
                self.symmops.append(op)
                self.rot_sym.append((v, 2))
142692
def Rx(rads: Union[float, sympy.Basic]) -> XPowGate:
    """"""
    pi = sympy.pi if protocols.is_parameterized(rads) else np.pi
    return XPowGate(exponent=rads / pi, global_shift=-0.5)
509079
def angle2d(self):
        """"""
        if self.x==0:
            if   self.y<0:  return       math.pi/2.0*3
            elif self.y>0:  return       math.pi/2.0
            else:           return 0
        elif self.y==0:
            if   self.x<0:  return       math.pi
           #elif self.x>0:  return 0
            else:           return 0
        ans = math.atan( self.y / self.x )
        if self.x > 0:
            if self.y>0:    return ans
            else:           return ans + math.pi*2.0
        else:               return ans + math.pi
854306
def angle_between_vectors(x, y):
    """"""
    first_step = abs(x[0] * y[0] + x[1] * y[1] + x[2] * y[2]) / (
        np.sqrt(x[0]**2 + x[1]**2 + x[2]**2) *
        np.sqrt(y[0]**2 + y[1]**2 + y[2]**2))
    second_step = np.arccos(first_step)
    return (second_step)
539548
function ( angle ) {
            var rad = this.DEG_TO_RAD * angle,
                cosVal = Math.cos( rad ),
                sinVal = Math.sin( rad ),
                mtx = new $B.geom.Matrix( cosVal, sinVal, -sinVal, cosVal, 0, 0 );
            return this.concat( mtx );
        }
111666
def unit_vector(self):
        """"""
        x = -math.cos(self.rpitch) * math.sin(self.ryaw)
        y = -math.sin(self.rpitch)
        z = math.cos(self.rpitch) * math.cos(self.ryaw)
        return Vector3(x, y, z)
1001216
def to_euler_rad(self, dst_euler_vec3=None):
        

        euler_vec3 = dst_euler_vec3 or Vec3(0.0, 0.0, 0.0)

        # TODO consolidated duplicated code in this function and to_euler_deg()
        sqw = self.w * self.w
        sqx = self.x * self.x
        sqy = self.y * self.y
        sqz = self.z * self.z

        euler_vec3.z = math.atan2(2.0 * (self.x * self.y + self.z * self.w),
                                  (sqx - sqy - sqz + sqw))
        euler_vec3.x = math.atan2(2.0 * (self.y * self.z + self.x * self.w),
                                  (-sqx - sqy + sqz + sqw))
        euler_vec3.y = math.asin(-2.0 * (self.x * self.z - self.y * self.w))
        return euler_vec3
770100
def get_RaDecOffsets(ra1_deg, dec1_deg, ra2_deg, dec2_deg):
    """"""
    delta_ra_deg = ra1_deg - ra2_deg
    adj = math.cos(math.radians(dec2_deg))
    if delta_ra_deg > 180.0:
        delta_ra_deg = (delta_ra_deg - 360.0) * adj
    elif delta_ra_deg < -180.0:
        delta_ra_deg = (delta_ra_deg + 360.0) * adj
    else:
        delta_ra_deg *= adj

    delta_dec_deg = dec1_deg - dec2_deg
    return (delta_ra_deg, delta_dec_deg)
1175411
def angle(vec1, vec2):
        """"""
        dotp = Vector2.dot(vec1, vec2)
        mag1 = vec1.length()
        mag2 = vec2.length()
        result = dotp / (mag1 * mag2)
        return math.acos(result)
273660
def angle( vertex_index )
      return nil if(vertex_index < 0 || vertex_index > 2)
      vert1 = self.vertices[vertex_index]
      vert2 = self.vertices[(vertex_index+1)%3]
      vert3 = self.vertices[(vertex_index+2)%3]
      vec1 = vert2 - vert1
      vec2 = vert3 - vert1
      vec1.angle(vec2)
    end
273930
def build_rotation(vec3):
        
        if not isinstance(vec3, Vector3):
            raise ValueError("rotAmt must be a Vector3")
        return Matrix4.x_rotate(vec3.x) * Matrix4.y_rotate(vec3.y) * Matrix4.z_rotate(vec3.z)