Draws a bounding box defined by the min/max coordinates.

min/max are THREE.Vector3 objects.
182334
function _drawBoundingBox(min, max, color) {
        var p = new Primitive();
        p.color = toColor(color);

        var halfExtents = new THREE.Vector3();
        halfExtents.subVectors(max, min);
        halfExtents.multiplyScalar(0.5);
        var center = new THREE.Vector3();
        center.addVectors(max, min);
        center.multiplyScalar(0.5);

        var edgeCoord = [1, 1, 1];

        for (var i = 0; i < 4; i++) {
            for (var j = 0; j < 3; j++) {
                var pa = new THREE.Vector3(
                    edgeCoord[0] * halfExtents.x,
                    edgeCoord[1] * halfExtents.y,
                    edgeCoord[2] * halfExtents.z);
                pa.add(center);

                var otherCoord = j % 3;
                edgeCoord[otherCoord] = edgeCoord[otherCoord] * -1;
                var pb = new THREE.Vector3(
                    edgeCoord[0] * halfExtents.x,
                    edgeCoord[1] * halfExtents.y,
                    edgeCoord[2] * halfExtents.z);
                pb.add(center);

                p.vertices.push(pa, pb);
            }

            edgeCoord = [-1, -1, -1];

            if (i < 3) {
                edgeCoord[i] = edgeCoord[i] * -1;
            }
        }

        renderer.addPrimitive(p);
    }
535763
public void drawBoxes(Graphics g){
		if ( fragmentPairs == null )
			return;

		g.setColor(Color.yellow);


		for (int i = 0; i < fragmentPairs.length; i++) {
			FragmentPair fp =fragmentPairs[i];
			int xp = fp.getPos1();
			int yp = fp.getPos2();

			int width = Math.round(scale);

			g.drawRect(Math.round(xp*scale),Math.round(yp*scale),width, width);

		}
	}
196332
public static void boundImage( GrayS64 img , long min , long max ) {
		ImplPixelMath.boundImage(img,min,max);
	}
1217295
function draw() {
    const options = {
      start: timeframeStartNode.value,
      end: timeframeEndNode.value,
      latitude: latNode.value,
      longitude: lngNode.value,
      radius: GEO.miles,
      zoom: GEO.zoom
    };

    const end = (options['end']) ? new Date(Date.parse(options['end'])) : new Date();
    const start = (options['start']) ? new Date(Date.parse(options['start'])) : new Date(end.getFullYear(), end.getMonth(), end.getDate() - 14);

    const rad = (options['radius']) ? parseFloat(options['radius']) : false;
    const lat = (options['latitude']) ? parseFloat(options['latitude']) : false;
    const lng = (options['longitude']) ? parseFloat(options['longitude']) : false;

    let geoFilter = [];
    if (lat && lng && rad) {
      geoFilter.push({
        property_name: 'keen.location.coordinates',
        operator: 'within',
        property_value: {
          coordinates: [parseFloat(options['longitude']), parseFloat(options['latitude'])],
          max_distance_miles: parseFloat(options['radius'])
        }
      });
    };

    const baseParams = {
      timeframe: {
        start: start.toISOString(),
        end: end.toISOString()
      },
      filters: geoFilter
    };

    // Fetch events within geo target
    const scoped_events = client.query('select_unique', {
      event_collection: 'user_action',
      target_property: 'keen.location.coordinates',
      timeframe: baseParams.timeframe,
      filters: baseParams.filters
    });
    client.run(scoped_events, (err, res) => {
      activeMapData.clearLayers();
      Keen.utils.each(res.result, coord => {
        const em = L.marker(new L.LatLng(coord[1], coord[0]), {
          icon: L.mapbox.marker.icon({
            'marker-color': '#00bbde'
          })
        }).addTo(activeMapData);;
      });
    });



    // Sample queries
    // groupBy not supported for Geo Filters

    const hearts = client.query('median', {
      event_collection: 'user_action',
      interval: 'daily',
      target_property: 'bio_sensors.heart_rate',
      timeframe: baseParams.timeframe,
      filters: baseParams.filters
    });

    const daily_median_heartrate = new KeenDataviz({
      container: '#chart-01',
      title: 'Daily Median Heart Rate',
      type: 'area',
      colors: ['#fe6672'],
    })

    client
      .run(hearts)
      .then(res => {
        daily_median_heartrate
          .data(res)
          .render()
      });


    const activations = client.query('count', {
      event_collection: 'activations',
      interval: 'daily',
      target_property: 'bio_sensors.heart_rate',
      timeframe: baseParams.timeframe,
      filters: baseParams.filters
    });

    const daily_activations = new KeenDataviz({
      container: '#chart-02',
      title: 'Daily Activations',
      type: 'area',
      colors: ['#fe6672'],
    });

    client
      .run(activations)
      .then(res => {
        daily_activations
          .data(res)
          .render()
      });


    const purchases = client.query('sum', {
      event_collection: 'purchases',
      target_property: 'order_price',
      interval: 'daily',
      timeframe: baseParams.timeframe,
      filters: baseParams.filters
    });

    const daily_purchases = new KeenDataviz({
      container: '#chart-03',
      title: 'Daily Purchases',
      type: 'area',
      colors: ['#eeb058'],
    });

    client
      .run(purchases)
      .then(res => {
        daily_purchases
          .data(res)
          .render()
      });

  }
577270
def display_bounding_boxes(img, blocks, alternatecolors=False, color=Color("blue")):
    
    draw = Drawing()
    draw.fill_color = Color("rgba(0, 0, 0, 0)")
    draw.stroke_color = color
    for block in blocks:
        top, left, bottom, right = block[-4:]
        if alternatecolors:
            draw.stroke_color = Color(
                "rgba({},{},{}, 1)".format(
                    str(np.random.randint(255)),
                    str(np.random.randint(255)),
                    str(np.random.randint(255)),
                )
            )
        draw.rectangle(
            left=float(left), top=float(top), right=float(right), bottom=float(bottom)
        )
        draw(img)
    display(img)
891490
def bounding_box(self):
        

        w2 = self.width / 2.
        h2 = self.height / 2.
        cos_angle = np.cos(self.angle)    # self.angle is a Quantity
        sin_angle = np.sin(self.angle)    # self.angle is a Quantity
        dx1 = abs(w2 * cos_angle - h2 * sin_angle)
        dy1 = abs(w2 * sin_angle + h2 * cos_angle)
        dx2 = abs(w2 * cos_angle + h2 * sin_angle)
        dy2 = abs(w2 * sin_angle - h2 * cos_angle)
        dx = max(dx1, dx2)
        dy = max(dy1, dy2)

        xmin = self.center.x - dx
        xmax = self.center.x + dx
        ymin = self.center.y - dy
        ymax = self.center.y + dy

        return BoundingBox.from_float(xmin, xmax, ymin, ymax)
972417
def DrawBox( self, dc, node, x,y,w,h, hot_map, depth=0 ):
        """"""
        log.debug( 'Draw: %s to (%s,%s,%s,%s) depth %s',
            node, x,y,w,h, depth,
        )
        if self.max_depth and depth > self.max_depth:
            return
        self.max_depth_seen = max( (self.max_depth_seen,depth))
        dc.SetBrush( self.BrushForNode( node, depth ) )
        dc.SetPen( self.PenForNode( node, depth ) )
        # drawing offset by margin within the square...
        dx,dy,dw,dh = x+self.margin,y+self.margin,w-(self.margin*2),h-(self.margin*2)
        if sys.platform == 'darwin':
            # Macs don't like drawing small rounded rects...
            if w < self.padding*2 or h < self.padding*2:
                dc.DrawRectangle( dx,dy,dw,dh )
            else:
                dc.DrawRoundedRectangle( dx,dy,dw,dh, self.padding )
        else:
            dc.DrawRoundedRectangle( dx,dy,dw,dh, self.padding*3 )
#        self.DrawIconAndLabel(dc, node, x, y, w, h, depth)
        children_hot_map = []
        hot_map.append( (wx.Rect( int(x),int(y),int(w),int(h)), node, children_hot_map ) )
        x += self.padding
        y += self.padding
        w -= self.padding*2
        h -= self.padding*2
        

        empty = self.adapter.empty( node )
        icon_drawn = False
        if self.max_depth and depth == self.max_depth:
            self.DrawIconAndLabel(dc, node, x, y, w, h, depth)
            icon_drawn = True
        elif empty:
            # is a fraction of the space which is empty...
            log.debug( '  empty space fraction: %s', empty )
            new_h = h * (1.0-empty)
            self.DrawIconAndLabel(dc, node, x, y, w, h-new_h, depth)
            icon_drawn = True
            y += (h-new_h)
            h = new_h

        if w >self.padding*2 and h> self.padding*2:
            children = self.adapter.children( node )
            if children:
                log.debug( '  children: %s', children )
                self.LayoutChildren( dc, children, node, x,y,w,h, children_hot_map, depth+1 )
            else:
                log.debug( '  no children' )
                if not icon_drawn:
                    self.DrawIconAndLabel(dc, node, x, y, w, h, depth)
        else:
            log.debug( '  not enough space: children skipped' )
388241
def bounding_box(self):
        
        if self.world_coords:
            return self.world_obj.findSolid().BoundingBox()
        return self.local_obj.findSolid().BoundingBox()
612618
def draw(svg, coords, options={})
      # Check whether to use color from theme, or whether to use user defined colors from the area_colors array
      color_count = nil
      if @area_colors && @area_colors.size > 0
        area_color = @area_colors[0]
        color_count = 1
      else
        puts "Never Set Area Color"
        area_color = color
      end

      # Draw Bottom Level Polygons (Original Coords)
      draw_poly(svg, coords, area_color, options = {})

      # Draw Lower Area Polygons
      if @baselines
        # Get the Color of this Area
        puts "Drawing Baselines"
        @baselines.sort! {|x,y| y <=> x }
        @baselines.each do |baseline|
          if color_count
            area_color = area_colors[color_count]
            color_count = color_count + 1
            puts area_color.to_s
            if color_count >= area_colors.size
              color_count = 0
            end
          end

          lower_poly_coords = create_lower_polygon_coords(translate_number(baseline), coords, options)
          draw_poly(svg, lower_poly_coords, area_color, options = {})
        end
      end
    end
1261800
function(rect) {
        var thisBoundingBox = this.getBoundingBox();
        var otherBoundingBox = rect.getBoundingBox();

        var left = Math.min(thisBoundingBox.x, otherBoundingBox.x);
        var top = Math.min(thisBoundingBox.y, otherBoundingBox.y);
        var right = Math.max(
            thisBoundingBox.x + thisBoundingBox.width,
            otherBoundingBox.x + otherBoundingBox.width);
        var bottom = Math.max(
            thisBoundingBox.y + thisBoundingBox.height,
            otherBoundingBox.y + otherBoundingBox.height);

        return new $.Rect(
            left,
            top,
            right - left,
            bottom - top);
    }
967507
def bounding_box(locations):
    
    x_values = list(map(itemgetter(0), locations))
    x_min, x_max = min(x_values), max(x_values)
    y_values = list(map(itemgetter(1), locations))
    y_min, y_max = min(y_values), max(y_values)
    return Rect(x_min, y_min, x_max - x_min, y_max - y_min)
1363134
def enclosing_box(boxes):
        
        x = max(0, min([box.x for box in boxes]))
        y = max(0, min([box.y for box in boxes]))
        x2 = max([box.bottom_right()[0] for box in boxes])
        y2 = max([box.bottom_right()[1] for box in boxes])
        return Box.from_xy(x, y, x2, y2)
1049375
function randomInBox(box, v) {
    v = v || new three.Vector3();

    v.x = three.Math.randFloat(box.min.x, box.max.x);
    v.y = three.Math.randFloat(box.min.y, box.max.y);
    v.z = three.Math.randFloat(box.min.z, box.max.z);

    return v;
  }
514865
def draw_box(cb, x0, y0, w, h, fg=colors.default_fg, bg=colors.default_bg, h_seps=[], v_seps=[]):
    
    w -= 1
    h -= 1
    corners = [(x0, y0), (x0 + w, y0), (x0, y0 + h), (x0 + w, y0 + h)]

    fg = fg()
    bg = bg()

    for i, c in enumerate(corners):
        cb.put(c[0], c[1], BOX_CORNERS[i], fg, bg)

    for s in h_seps + [0, h]:
        cb.put(x0 + 1, y0 + s, symbols["BOX_HORIZONTAL"] * (w - 1), fg, bg)

    for y in range(1, h):
        for s in v_seps + [0, w]:
            cb.put(x0 + s, y0 + y, symbols["BOX_VERTICAL"], fg, bg)

    for s in h_seps:
        cb.put(x0,     y0 + s, symbols["BOX_X_LEFT"],  fg, bg)
        cb.put(x0 + w, y0 + s, symbols["BOX_X_RIGHT"], fg, bg)

    for s in v_seps:
        cb.put(x0 + s, y0,     symbols["BOX_X_TOP"],    fg, bg)
        cb.put(x0 + s, y0 + h, symbols["BOX_X_BOTTOM"], fg, bg)
579103
function drawBoxes() {
            boxes = svg.select('.chart-group').selectAll('.box').data(data);

            boxes.enter()
              .append('rect')
                .classed('box', true)
                .attr('width', boxSize)
                .attr('height', boxSize)
                .attr('x', ({hour}) => hour * boxSize)
                .attr('y', ({day}) => day * boxSize)
                .style('opacity', boxInitialOpacity)
                .style('fill', boxInitialColor)
                .style('stroke', boxBorderColor)
                .style('stroke-width', boxBorderSize)
                .transition()
                    .duration(animationDuration)
                    .style('fill', ({value}) => colorScale(value))
                    .style('opacity', boxFinalOpacity);

            boxes.exit().remove();
        }
664907
function (paths) {
			var maxX = Number.MIN_VALUE, 
				minX =  Number.MAX_VALUE, 
				maxY = Number.MIN_VALUE, 
				minY =  Number.MAX_VALUE;
			
			
			// Find the bounding box
			each(paths || this.options.data, function (point) {
				var path = point.path,
					i = path.length,
					even = false, // while loop reads from the end
					pointMaxX = Number.MIN_VALUE, 
					pointMinX =  Number.MAX_VALUE, 
					pointMaxY = Number.MIN_VALUE, 
					pointMinY =  Number.MAX_VALUE;
					
				while (i--) {
					if (typeof path[i] === 'number' && !isNaN(path[i])) {
						if (even) { // even = x
							pointMaxX = Math.max(pointMaxX, path[i]);
							pointMinX = Math.min(pointMinX, path[i]);
						} else { // odd = Y
							pointMaxY = Math.max(pointMaxY, path[i]);
							pointMinY = Math.min(pointMinY, path[i]);
						}
						even = !even;
					}
				}
				// Cache point bounding box for use to position data labels
				point._maxX = pointMaxX;
				point._minX = pointMinX;
				point._maxY = pointMaxY;
				point._minY = pointMinY;

				maxX = Math.max(maxX, pointMaxX);
				minX = Math.min(minX, pointMinX);
				maxY = Math.max(maxY, pointMaxY);
				minY = Math.min(minY, pointMinY);
			});
			this.minY = minY;
			this.maxY = maxY;
			this.minX = minX;
			this.maxX = maxX;
			
		}
915463
def bezier_bounding_box(bez):
    """"""

    # begin arc support block ########################
    try:
        bla = bez.large_arc
        return bez.bbox()  # added to support Arc objects
    except:
        pass
    # end arc support block ##########################

    if len(bez) == 4:
        xmin, xmax = bezier_real_minmax([p.real for p in bez])
        ymin, ymax = bezier_real_minmax([p.imag for p in bez])
        return xmin, xmax, ymin, ymax
    poly = bezier2polynomial(bez, return_poly1d=True)
    x = real(poly)
    y = imag(poly)
    dx = x.deriv()
    dy = y.deriv()
    x_extremizers = [0, 1] + polyroots(dx, realroots=True,
                                    condition=lambda r: 0 < r < 1)
    y_extremizers = [0, 1] + polyroots(dy, realroots=True,
                                    condition=lambda r: 0 < r < 1)
    x_extrema = [x(t) for t in x_extremizers]
    y_extrema = [y(t) for t in y_extremizers]
    return min(x_extrema), max(x_extrema), min(y_extrema), max(y_extrema)