Helper method: Wrap any angle to lie between -pi and pi

        Odd multiples of pi are wrapped to +pi (as opposed to -pi)
198400
def _wrap_angle(self, theta):
        
        result = ((theta + pi) % (2*pi)) - pi
        if result == -pi: result = pi
        return result
867936
function(degrees, pivot) {
        degrees = $.positiveModulo(degrees, 360);
        if (degrees === 0) {
            return this.clone();
        }

        pivot = pivot || this.getCenter();
        var newTopLeft = this.getTopLeft().rotate(degrees, pivot);
        var newTopRight = this.getTopRight().rotate(degrees, pivot);

        var diff = newTopRight.minus(newTopLeft);
        // Handle floating point error
        diff = diff.apply(function(x) {
            var EPSILON = 1e-15;
            return Math.abs(x) < EPSILON ? 0 : x;
        });
        var radians = Math.atan(diff.y / diff.x);
        if (diff.x < 0) {
            radians += Math.PI;
        } else if (diff.y < 0) {
            radians += 2 * Math.PI;
        }
        return new $.Rect(
            newTopLeft.x,
            newTopLeft.y,
            this.width,
            this.height,
            radians / Math.PI * 180);
    }
1363672
function backEaseIn (p) {
    return p * p * p - p * Math.sin(p * Math.PI);
}
462270
def angle2xyz(azi, zen):
    """"""
    azi = xu.deg2rad(azi)
    zen = xu.deg2rad(zen)
    x = xu.sin(zen) * xu.sin(azi)
    y = xu.sin(zen) * xu.cos(azi)
    z = xu.cos(zen)
    return x, y, z
1368992
def angle(self, other):
        """"""
        return math.acos(self.dot(other) / (self.magnitude() * other.magnitude()))
180822
def _do_pi(self, node):
        '''
        '''
        if not _in_subset(self.subset, node): return
        W = self.write
        if self.documentOrder == _GreaterElement: W('\n')
        W('<?')
        W(node.nodeName)
        s = node.data
        if s:
            W(' ')
            W(s)
        W('?>')
        if self.documentOrder == _LesserElement: W('\n')
912299
function(obj) {
                if (obj.normal || (obj.start && obj.end)) { return obj.isParallelTo(this); }
                var theta = this.direction.angleFrom(obj.direction);
                return (Math.abs(theta) <= sylvester.precision || Math.abs(theta - Math.PI) <= sylvester.precision);
              }
1090810
function getAngle(touch1, touch2) {
    var x = touch2.clientX - touch1.clientX,
        y = touch2.clientY - touch1.clientY;

    return Math.atan2(y, x) * 180 / Math.PI;
  }
1312500
def rho2sigma(self, rho0, Ra, Rs):
        
        return np.pi * rho0 * Ra * Rs / (Rs + Ra)
1206606
def _bend_angle_low(a, b, deriv):
    """"""
    result = _bend_cos_low(a, b, deriv)
    return _cos_to_angle(result, deriv)
1304977
def spin1y_from_xi1_phi_a_phi_s(xi1, phi_a, phi_s):
    
    phi1 = phi1_from_phi_a_phi_s(phi_s, phi_a)
    return xi1 * numpy.sin(phi1)
526865
def theta_limit(theta):
    
    while theta <= -1 * np.pi / 2:
        theta += np.pi
    while theta > np.pi / 2:
        theta -= np.pi
    return theta
247581
def create_from_euler_angles(cls, rx, ry, rz, degrees=False):
        
        if degrees:
            rx, ry, rz = np.radians([rx, ry, rz])
        # Obtain quaternions
        qx = Quaternion(np.cos(rx/2), 0, 0, np.sin(rx/2))
        qy = Quaternion(np.cos(ry/2), 0, np.sin(ry/2), 0)
        qz = Quaternion(np.cos(rz/2), np.sin(rz/2), 0, 0)
        # Almost done
        return qx*qy*qz
170650
public float angle() {
        float angle = (float) (2.0 * Math.acos(w));
        return (float) (angle <= Math.PI ? angle : Math.PI + Math.PI - angle);
    }
701477
def _mul_array(self, p, q):
        
        assert(len(q) == len(p) == 4)
        p0 = p[0]
        pi = p[1:4]
        q0 = q[0]
        qi = q[1:4]

        res = np.zeros(4)
        res[0] = p0 * q0 - np.dot(pi, qi)
        res[1:4] = p0 * qi + q0 * pi + np.cross(pi, qi)

        return res
718112
function(plane) {
                var theta = this.normal.angleFrom(plane.normal);
                return (Math.abs(Math.PI/2 - theta) <= sylvester.precision);
              }
1246465
def get_angle(self, i: int, j: int, k: int) -> float:
        
        v1 = self[i].coords - self[j].coords
        v2 = self[k].coords - self[j].coords
        return get_angle(v1, v2, units="degrees")