Rotate counter-clockwise around a point, by theta degrees.

        Positive y goes *up,* as in traditional mathematics.

        The new position is returned as a new Point.
545240
def rotate_about(self, p, theta):
        
        result = self.clone()
        result.translate(-p.x, -p.y)
        result.rotate(theta)
        result.translate(p.x, p.y)
        return result
1048977
def cart2spher(x, y, z):
    """"""
    hxy = np.hypot(x, y)
    r = np.hypot(hxy, z)
    theta = np.arctan2(z, hxy)
    phi = np.arctan2(y, x)
    return r, theta, phi
1337900
def rotate_point(xorigin, yorigin, x, y, angle):
    
    rotx = (x - xorigin) * np.cos(angle) - (y - yorigin) * np.sin(angle)
    roty = (x - yorigin) * np.sin(angle) + (y - yorigin) * np.cos(angle)
    return rotx, roty
828083
def rotate_x(self, angle):
        
        axis_rotation(self.points, angle, inplace=True, axis='x')
286701
public void rotate(double cos, double sin, Point2D rotationCenter) {
		Transformation2D temp = new Transformation2D();
		temp.setRotate(cos, sin, rotationCenter);
		multiply(temp);
	}
615436
public void rotate(double theta) {
		// Copied from AWT API
		final double sin = Math.sin(theta);
		if (sin == 1.) {
			rotate90();
		} else if (sin == -1.) {
			rotate270();
		} else {
			final double cos = Math.cos(theta);
			if (cos == -1.) {
				rotate180();
			} else if (cos != 1.) {
				double m0 = this.m00;
				double m1 = this.m01;
				this.m00 =  cos * m0 + sin * m1;
				this.m01 = -sin * m0 + cos * m1;
				m0 = this.m10;
				m1 = this.m11;
				this.m10 =  cos * m0 + sin * m1;
				this.m11 = -sin * m0 + cos * m1;
			}
		}
	}
1072431
def x_rotate(rotationAmt):
        """"""
        ma4 = Matrix4((1, 0, 0, 0),
                      (0, math.cos(rotationAmt), -math.sin(rotationAmt), 0),
                      (0, math.sin(rotationAmt), math.cos(rotationAmt), 0),
                      (0, 0, 0, 1))

        return ma4
769802
function adjustQuadrant(quadrant, point, opposite) {
		if ((opposite.x == point.x) || (opposite.y == point.y)) return quadrant;
		var flipHorizontally = [4, 3, 2, 1]
		var flipVertically = [2, 1, 4, 3]
		var oppositeQuadrant = (opposite.y < point.y) ?
							((opposite.x < point.x) ? 2 : 1) :
							((opposite.x < point.x) ? 3 : 4);
		// if an opposite relation end is in the same quadrant as a label, we need to flip the label
		if (oppositeQuadrant === quadrant) {
			if (config.direction === 'LR') return flipHorizontally[quadrant-1];
			if (config.direction === 'TD') return flipVertically[quadrant-1];
		}
		return quadrant; 	
	}
178813
function(axis, theta) {
        var x, y, z, s, c, t, tx, ty;
        x = axis.x;
        y = axis.y;
        z = axis.z;
        s = Math.sin(theta);
        c = Math.cos(theta);
        t = 1 - c;
        tx = t * x;
        ty = t * y;
		_TEMP.set(
			tx * x + c, tx * y + s * z, tx * z - s * y, 0, tx * y - s * z,
			ty * y + c, ty * z + s * x, 0, tx * z + s * y, ty * z - s * x,
			t * z * z + c, 0, 0, 0, 0, 1
		);
        return this.multiplySelf(_TEMP);
    }
643869
def rotate(self, angle):
        
        x, y = self.tuple
        self.x = x * math.cos(angle) - y * math.sin(angle)
        self.y = x * math.sin(angle) + y * math.cos(angle)
9067
function rotateGlobe(b, a, bRadius) {
  var br, brp, alat, acos, asin, bx, by, bz;

  // Get modified coordinates of 'b' by rotating the globe so
  // that 'a' is at lat=0, lng=0
  br = { lat: b.lat, lng: (b.lng - a.lng), elv:b.elv };
  brp = locationToPoint(br);

  // scale all the coordinates based on the original, correct geoid radius
  brp.x *= (bRadius / brp.radius);
  brp.y *= (bRadius / brp.radius);
  brp.z *= (bRadius / brp.radius);

  // restore actual geoid-based radius calculation
  brp.radius = bRadius;

  // Rotate brp cartesian coordinates around the z-axis by a.lng degrees,
  // then around the y-axis by a.lat degrees.
  // Though we are decreasing by a.lat degrees, as seen above the y-axis,
  // this is a positive (counterclockwise) rotation
  // (if B's longitude is east of A's).
  // However, from this point of view the x-axis is pointing left.
  // So we will look the other way making the x-axis pointing right, the z-axis
  // pointing up, and the rotation treated as negative.
  alat = -a.lat * Math.PI / 180.0;
  acos = Math.cos(alat);
  asin = Math.sin(alat);

  bx = (brp.x * acos) - (brp.z * asin);
  by = brp.y;
  bz = (brp.x * asin) + (brp.z * acos);

  return { x: bx, y: by, z: bz };
}
1016985
function(theta) {
            while (theta < 0) {
                theta += mathUtils.TWO_PI;
            }
            return this.sinLUT[((theta * this.rad2deg) + this.quadrant) % this.period];
        }
1092908
def set_rotation(self, rotation):
        """"""
        self._rotation = np.radians(rotation)
        self._polar.set_theta_offset(self._rotation + np.pi / 2.0)
        self.transData.invalidate()
        self.transAxes.invalidate()
        self._set_lim_and_transforms()
144988
function(p) {

            p = new Point(p);

            // Invert the y-axis.
            var y = -(p.y - this.y);
            var x = p.x - this.x;
            var rad = atan2(y, x); // defined for all 0 corner cases

            // Correction for III. and IV. quadrant.
            if (rad < 0) {
                rad = 2 * PI + rad;
            }

            return 180 * rad / PI;
        }
283692
def _create_and_rotate_coordinate_arrays(self, x, y, orientation):
        
        # Using this two-liner requires that x increase from left to
        # right and y decrease from left to right; I don't think it
        # can be rewritten in so little code otherwise - but please
        # prove me wrong.
        pattern_y = np.subtract.outer(np.cos(orientation)*y, np.sin(orientation)*x)
        pattern_x = np.add.outer(np.sin(orientation)*y, np.cos(orientation)*x)
        return pattern_x, pattern_y
909339
function(theta) {
			var co = Math.cos(theta);
			var si = Math.sin(theta);
			var xx = co * this.x - si * this.y;
			this.y = si * this.x + co * this.y;
			this.x = xx;
			return this;
		}
1132914
public void rotate(double t, double p) {
        theta = theta - t / 100;
        phi = phi + p / 100;
        precompute();
        reset();
    }