r"""Rotate and translate a curve.
177075
def rotate_and_traslate(cur, alpha, v0):
    """
    if len(cur) > 2 or (type(cur[0][0]) in [list, tuple]):
        cur_list = cur[:]
        for i in range(len(cur_list)):
            curi = cur_list[i]
            curi = rotate_and_traslate(curi, alpha, v0)
            cur_list[i] = curi
        return cur_list
    else:
        x0, y0 = cur
        rot = np.matrix([[cos(alpha), -sin(alpha)], [sin(alpha), cos(alpha)]])
        xn = []; yn = []
        for i in range(len(x0)):
            v = np.matrix([[x0[i]], [y0[i]]])

            vi = np.dot(rot, v)
            xn += [float(vi[0][0])+v0[0]]; yn += [float(vi[1][0])+v0[1]]

        return xn, yn
1361863
def rotate(self, shift):
        '''
        
        '''
        self.child_corners.values[:] = np.roll(self.child_corners
                                                 .values, shift, axis=0)
        self.update_transform()
572304
def rotate(self, theta_deg, xoff=0, yoff=0):
        
        self.rotate_deg([theta_deg], (xoff, yoff))
654532
def curve(self):
        """"""
        return HelicalCurve.pitch_and_radius(
            self.major_pitch, self.major_radius,
            handedness=self.major_handedness)
1045782
function(node,x,y,size,context) {
    var rotate = Math.PI*45/180; // 45 deg rotation of a diamond shape
    context.moveTo(x+size*Math.sin(rotate), y-size*Math.cos(rotate)); // first point on outer radius, dwangle 'rotate'
    for(var i=1; i<4; i++) {
      context.lineTo(x+Math.sin(rotate+2*Math.PI*i/4)*size, y-Math.cos(rotate+2*Math.PI*i/4)*size);
    }
  }
1370153
def rotateTo(self, angle):
        
        self._transmogrophy(angle, self.percent, self.scaleFromCenter, self.flipH, self.flipV)
635337
def pol2cart(theta, rho):
    """"""
    x = rho * np.cos(theta)
    y = rho * np.sin(theta)
    return x, y
65414
function pathRotate(contour, angle, centerX, centerY) {
            angle = angle === undefined ? 0 : angle;
            var x = centerX || 0;
            var y = centerY || 0;
            var cos = Math.cos(angle);
            var sin = Math.sin(angle);
            var px;
            var py;
            var p;

            // x1=cos(angle)*x-sin(angle)*y;
            // y1=cos(angle)*y+sin(angle)*x;
            for (var i = 0, l = contour.length; i < l; i++) {
                p = contour[i];
                px = cos * (p.x - x) - sin * (p.y - y);
                py = cos * (p.y - y) + sin * (p.x - x);
                p.x = px + x;
                p.y = py + y;
            }

            return contour;
        }
27080
function(rot){
        var r = OIMO.EulerToAxis( rot.x * OIMO.TO_RAD, rot.y * OIMO.TO_RAD, rot.z * OIMO.TO_RAD );
        return this.rotationAxisToQuad(r[0], r[1], r[2], r[3]);
    }
1089880
def axis_rotation_matrix(axis, theta):
    """"""
    [x, y, z] = axis
    c = np.cos(theta)
    s = np.sin(theta)
    return np.array([
        [x**2 + (1 - x**2) * c, x * y * (1 - c) - z * s, x * z * (1 - c) + y * s],
        [x * y * (1 - c) + z * s, y ** 2 + (1 - y**2) * c, y * z * (1 - c) - x * s],
        [x * z * (1 - c) - y * s, y * z * (1 - c) + x * s, z**2 + (1 - z**2) * c]
    ])
962959
function rotatePaths(paths, angle) {
            if (!angle) {
                return paths;
            }

            var bound = computeBoundingBox.computePath.apply(null, paths);

            var cx = bound.x + (bound.width) / 2;
            var cy = bound.y + (bound.height) / 2;

            paths.forEach(function (p) {
                pathRotate(p, angle, cx, cy);
            });

            return paths;
        }
1121339
def _rotate(degrees:uniform):
    ""
    angle = degrees * math.pi / 180
    return [[cos(angle), -sin(angle), 0.],
            [sin(angle),  cos(angle), 0.],
            [0.        ,  0.        , 1.]]
841522
def curve_constructor(curve):
    """"""
    if NO_IMAGES:
        return

    ax = curve.plot(256)
    line = ax.lines[0]
    nodes = curve._nodes
    ax.plot(
        nodes[0, :], nodes[1, :], color="black", linestyle="None", marker="o"
    )
    add_patch(ax, nodes, line.get_color())
    ax.axis("scaled")
    ax.set_xlim(-0.125, 1.125)
    ax.set_ylim(-0.0625, 0.5625)
    save_image(ax.figure, "curve_constructor.png")
1167630
function(d) {
          var i = d3.interpolate(this._current, d);
          this._current = i(0);
          return function(t) {
            return 'translate(' + arc.centroid(i(t)) + ') rotate(' + labelAngle(d) + ')';
          };
        }
859801
function transformCoordinate(canvas, width, height, orientation) {
        switch (orientation) {
            case 5:
            case 6:
            case 7:
            case 8:
                canvas.width = height;
                canvas.height = width;
                break;
            default:
                canvas.width = width;
                canvas.height = height;
        }
        var ctx = canvas.getContext("2d");
        switch (orientation) {
            case 2:
                // horizontal flip
                ctx.translate(width, 0);
                ctx.scale(-1, 1);
                break;
            case 3:
                // 180 rotate left
                ctx.translate(width, height);
                ctx.rotate(Math.PI);
                break;
            case 4:
                // vertical flip
                ctx.translate(0, height);
                ctx.scale(1, -1);
                break;
            case 5:
                // vertical flip + 90 rotate right
                ctx.rotate(0.5 * Math.PI);
                ctx.scale(1, -1);
                break;
            case 6:
                // 90 rotate right
                ctx.rotate(0.5 * Math.PI);
                ctx.translate(0, -height);
                break;
            case 7:
                // horizontal flip + 90 rotate right
                ctx.rotate(0.5 * Math.PI);
                ctx.translate(width, -height);
                ctx.scale(-1, 1);
                break;
            case 8:
                // 90 rotate left
                ctx.rotate(-0.5 * Math.PI);
                ctx.translate(-width, 0);
                break;
            default:
                break;
        }
    }
1225485
def apply_trans_rot(ampal, translation, angle, axis, point, radians=False):
    """"""
    if not numpy.isclose(angle, 0.0):
        ampal.rotate(angle=angle, axis=axis, point=point, radians=radians)
    ampal.translate(vector=translation)
    return
1253873
def rotate(curve, degs, origin=None):
    
    def transform(z):
        return exp(1j*radians(degs))*(z - origin) + origin

    if origin is None:
        if isinstance(curve, Arc):
            origin = curve.center
        else:
            origin = curve.point(0.5)

    if isinstance(curve, Path):
        return Path(*[rotate(seg, degs, origin=origin) for seg in curve])
    elif is_bezier_segment(curve):
        return bpoints2bezier([transform(bpt) for bpt in curve.bpoints()])
    elif isinstance(curve, Arc):
        new_start = transform(curve.start)
        new_end = transform(curve.end)
        new_rotation = curve.rotation + degs
        return Arc(new_start, radius=curve.radius, rotation=new_rotation,
                   large_arc=curve.large_arc, sweep=curve.sweep, end=new_end)
    else:
        raise TypeError("Input `curve` should be a Path, Line, "
                        "QuadraticBezier, CubicBezier, or Arc object.")