rotate bezier so that {start->end is a horizontal} line,
then compute standard bbox, and counter-rotate it.
425307
function calculateStraightenedBoundingBox(x1, y1, cx1, cy1, cx2, cy2, x2, y2) {
  var angle = 0;
  var dx = x2 - x1;
  var dy = y2 - y1;

  if (dy == 0) {
    return canculateStandardBoundingBox(x1, y1, cx1, cy1, cx2, cy2, x2, y2);
  }

  var adx = Math.abs(dx);
  var ady = Math.abs(dy);

  var d1 = 0.0;
  var d2 = 90.0;
  var d3 = 180.0;
  var d4 = 270.0;
  var PI = Math.PI;
  var sin = Math.sin;
  var cos = Math.cos;

  if (dx == 0) angle = dy >= 0 ? d2 : d4;else if (dx > 0 && dy > 0) angle = d1 + Math.atan(ady / adx) * (180 / PI); // X+, Y+
  else if (dx < 0 && dy < 0) angle = d3 + Math.atan(ady / adx) * (180 / PI); // X-, Y-
    else if (dx < 0 && dy > 0) angle = d2 + Math.atan(adx / ady) * (180 / PI); // X-, Y+
      else if (dx > 0 && dy < 0) angle = d4 + Math.atan(adx / ady) * (180 / PI); // X+, Y-

  var phi = -(angle * PI / 180.0);

  cx1 -= x1;
  cy1 -= y1;
  cx2 -= x1;
  cy2 -= y1;
  x2 -= x1;
  y2 -= y1;

  var ncx1 = cx1 * cos(phi) - cy1 * sin(phi);
  var ncy1 = cx1 * sin(phi) + cy1 * cos(phi);
  var ncx2 = cx2 * cos(phi) - cy2 * sin(phi);
  var ncy2 = cx2 * sin(phi) + cy2 * cos(phi);
  var nx2 = x2 * cos(phi) - y2 * sin(phi);
  var ny2 = x2 * sin(phi) + y2 * cos(phi);

  var bounds = canculateStandardBoundingBox(0, 0, ncx1, ncy1, ncx2, ncy2, nx2, ny2);

  phi = angle * PI / 180.0;

  return [x1 + (bounds[0] * Math.cos(phi) - bounds[1] * Math.sin(phi)), y1 + (bounds[0] * Math.sin(phi) + bounds[1] * Math.cos(phi)), x1 + (bounds[2] * Math.cos(phi) - bounds[3] * Math.sin(phi)), y1 + (bounds[2] * Math.sin(phi) + bounds[3] * Math.cos(phi)), x1 + (bounds[4] * Math.cos(phi) - bounds[5] * Math.sin(phi)), y1 + (bounds[4] * Math.sin(phi) + bounds[5] * Math.cos(phi)), x1 + (bounds[6] * Math.cos(phi) - bounds[7] * Math.sin(phi)), y1 + (bounds[6] * Math.sin(phi) + bounds[7] * Math.cos(phi))];
}
638655
void bezierTo(Point2D controlPoint1, Point2D controlPoint2, Point2D endPoint) {
		m_impl.bezierTo(controlPoint1, controlPoint2, endPoint);
	}
48643
def bbox_hflip(bbox, rows, cols):
    """"""
    x_min, y_min, x_max, y_max = bbox
    return [1 - x_max, y_min, 1 - x_min, y_max]
364882
function (x, y) {

      var t = this._currentTransform,
          o = this._offset;

      if (t.target.lockRotation) return;

      var lastAngle = atan2(t.ey - t.top - o.top, t.ex - t.left - o.left),
          curAngle = atan2(y - t.top - o.top, x - t.left - o.left);

      t.target._theta = (curAngle - lastAngle) + t.theta;
    }
918854
def get_4pt_bezier(steps, points):
    """"""
    for i in range(steps):
        t = i / float(steps)

        xloc = (math.pow(1 - t, 3) * points[0][0] +
                3 * t * math.pow(1 - t, 2) * points[1][0] +
                3 * (1 - t) * math.pow(t, 2) * points[2][0] +
                math.pow(t, 3) * points[3][0])
        yloc = (math.pow(1 - t, 3) * points[0][1] +
                3 * t * math.pow(1 - t, 2) * points[1][1] +
                3 * (1 - t) * math.pow(t, 2) * points[2][1] +
                math.pow(t, 3) * points[3][1])

        yield (xloc, yloc)
88539
def flip(self, axis=0, preserve_centroid=False):
        '''
        

        '''
        self.v[:, axis] *= -1

        if preserve_centroid:
            self.v[:, axis] -= 2 * self.centroid[0]

        self.flip_faces()
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
639313
function rotateX(out, a, b, c){
    var by = b[1]
    var bz = b[2]

    // Translate point to the origin
    var py = a[1] - by
    var pz = a[2] - bz

    var sc = Math.sin(c)
    var cc = Math.cos(c)

    // perform rotation and translate to correct position
    out[0] = a[0]
    out[1] = by + py * cc - pz * sc
    out[2] = bz + py * sc + pz * cc

    return out
}
489811
public static AxisAlignedBB rotate(AxisAlignedBB aabb, int angle, Axis axis)
	{
		if (aabb == null || angle == 0 || axis == null)
			return aabb;

		int a = -angle & 3;
		int s = sin[a];
		int c = cos[a];

		aabb = aabb.offset(-0.5F, -0.5F, -0.5F);

		double minX = aabb.minX;
		double minY = aabb.minY;
		double minZ = aabb.minZ;
		double maxX = aabb.maxX;
		double maxY = aabb.maxY;
		double maxZ = aabb.maxZ;

		if (axis == Axis.X)
		{
			minY = (aabb.minY * c) - (aabb.minZ * s);
			maxY = (aabb.maxY * c) - (aabb.maxZ * s);
			minZ = (aabb.minY * s) + (aabb.minZ * c);
			maxZ = (aabb.maxY * s) + (aabb.maxZ * c);

		}
		if (axis == Axis.Y)
		{
			minX = (aabb.minX * c) - (aabb.minZ * s);
			maxX = (aabb.maxX * c) - (aabb.maxZ * s);
			minZ = (aabb.minX * s) + (aabb.minZ * c);
			maxZ = (aabb.maxX * s) + (aabb.maxZ * c);
		}

		if (axis == Axis.Z)
		{
			minX = (aabb.minX * c) - (aabb.minY * s);
			maxX = (aabb.maxX * c) - (aabb.maxY * s);
			minY = (aabb.minX * s) + (aabb.minY * c);
			maxY = (aabb.maxX * s) + (aabb.maxY * c);
		}

		aabb = new AxisAlignedBB(minX + 0.5F, minY + 0.5F, minZ + 0.5F, maxX + 0.5F, maxY + 0.5F, maxZ + 0.5F);

		return aabb;
	}
408891
function handleToSlidee(handlePos) {
            return Math.round(within(handlePos, hPos.start, hPos.end) / hPos.end * (pos.end - pos.start)) + pos.start;
        }
553669
def arc(self, x, y, radius, start_angle, end_angle):
        """"""
        self._add_instruction("arc", x, y, radius, start_angle, end_angle)
474829
function (start, end, pos, complete) {
		var ret = [],
			i = start.length,
			startVal;

		if (pos === 1) { // land on the final path without adjustment points appended in the ends
			ret = complete;

		} else if (i === end.length && pos < 1) {
			while (i--) {
				startVal = parseFloat(start[i]);
				ret[i] =
					isNaN(startVal) ? // a letter instruction like M or L
						start[i] :
						pos * (parseFloat(end[i] - startVal)) + startVal;

			}
		} else { // if animation is finished or length not matching, land on right value
			ret = end;
		}
		return ret;
	}
877554
def reversed(self):
        """"""
        new_quad = QuadraticBezier(self.end, self.control, self.start)
        if self._length_info['length']:
            new_quad._length_info = self._length_info
            new_quad._length_info['bpoints'] = (
                self.end, self.control, self.start)
        return new_quad
1222093
function calculateBezier(t, p0, p1, p2, p3) {
  var mt = 1 - t;
  return mt * mt * mt * p0 + 3 * mt * mt * t * p1 + 3 * mt * t * t * p2 + t * t * t * p3;
}
13255
function(x, y) {
		if (lang.isValue(x) && lang.isValue(y)) {
			var ctxt = this.getContext();
		
			// Draw the inner bezier curve
			ctxt.lineCap= "round";
			ctxt.strokeStyle="green";
			ctxt.lineWidth="3";

			ctxt.lineTo(x, y);
			ctxt.stroke();
	   }
	}
950679
function (x, y, w, h, options) {
			var start = options.start,
				end = options.end,
				radius = options.r || w || h,
				innerRadius = options.innerR,
				cosStart = mathCos(start),
				sinStart = mathSin(start),
				cosEnd = mathCos(end),
				sinEnd = mathSin(end),
				ret;

			if (end - start === 0) { // no angle, don't show it.
				return ['x'];
			}

			ret = [
				'wa', // clockwise arc to
				x - radius, // left
				y - radius, // top
				x + radius, // right
				y + radius, // bottom
				x + radius * cosStart, // start x
				y + radius * sinStart, // start y
				x + radius * cosEnd, // end x
				y + radius * sinEnd  // end y
			];

			if (options.open && !innerRadius) {
				ret.push(
					'e',
					M,
					x,// - innerRadius,
					y// - innerRadius
				);
			}

			ret.push(
				'at', // anti clockwise arc to
				x - innerRadius, // left
				y - innerRadius, // top
				x + innerRadius, // right
				y + innerRadius, // bottom
				x + innerRadius * cosEnd, // start x
				y + innerRadius * sinEnd, // start y
				x + innerRadius * cosStart, // end x
				y + innerRadius * sinStart, // end y
				'x', // finish path
				'e' // close
			);

			ret.isArc = true;
			return ret;

		}
31297
def head(line, n: int):
    """"""
    global counter
    counter += 1

    if counter > n:
        raise cbox.Stop()  # can also raise StopIteration()
    return line