// Box return the BoxCorners as a regular box.
551392
func (bc BoxCorners) Box() Box {
	return Box{
		Top:    util.Math.MinInt(bc.TopLeft.Y, bc.TopRight.Y),
		Left:   util.Math.MinInt(bc.TopLeft.X, bc.BottomLeft.X),
		Right:  util.Math.MaxInt(bc.TopRight.X, bc.BottomRight.X),
		Bottom: util.Math.MaxInt(bc.BottomLeft.Y, bc.BottomRight.Y),
	}
}
801968
func (service *VboxPortType) IMediumcompact(request *IMediumcompact) (*IMediumcompactResponse, error) {
	response := new(IMediumcompactResponse)
	err := service.client.Call("", request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
1238057
func NewBox(name string, path string) *Box {
	if len(name) == 0 {
		name = path
	}
	name = strings.Replace(name, "\"", "", -1)
	pwd, _ := os.Getwd()
	box := &Box{
		Name: name,
		Path: path,
		PWD:  pwd,
	}
	return box
}
1138664
func (b *Box) String(name string) (string, error) {
	// check if box is embedded, optimized fast path
	if b.IsEmbedded() {
		// find file in embed
		ef := b.embed.Files[name]
		if ef == nil {
			return "", os.ErrNotExist
		}
		// return as string
		return ef.Content, nil
	}

	bts, err := b.Bytes(name)
	if err != nil {
		return "", err
	}
	return string(bts), nil
}
961705
func Box(src image.Image, radius float64) *image.RGBA {
	if radius <= 0 {
		return clone.AsRGBA(src)
	}

	length := int(math.Ceil(2*radius + 1))
	k := convolution.NewKernel(length, length)

	for x := 0; x < length; x++ {
		for y := 0; y < length; y++ {
			k.Matrix[y*length+x] = 1
		}
	}

	return convolution.Convolve(src, k.Normalized(), &convolution.Options{Bias: 0, Wrap: false, KeepAlpha: false})
}
656243
func PackJSONBytes(box string, name string, jbb string) error {
	var bb []byte
	err := json.Unmarshal([]byte(jbb), &bb)
	if err != nil {
		return err
	}
	PackBytes(box, name, bb)
	return nil
}
1058789
func (bc BoxCorners) Rotate(thetaDegrees float64) BoxCorners {
	cx, cy := bc.Center()

	thetaRadians := util.Math.DegreesToRadians(thetaDegrees)

	tlx, tly := util.Math.RotateCoordinate(cx, cy, bc.TopLeft.X, bc.TopLeft.Y, thetaRadians)
	trx, try := util.Math.RotateCoordinate(cx, cy, bc.TopRight.X, bc.TopRight.Y, thetaRadians)
	brx, bry := util.Math.RotateCoordinate(cx, cy, bc.BottomRight.X, bc.BottomRight.Y, thetaRadians)
	blx, bly := util.Math.RotateCoordinate(cx, cy, bc.BottomLeft.X, bc.BottomLeft.Y, thetaRadians)

	return BoxCorners{
		TopLeft:     Point{tlx, tly},
		TopRight:    Point{trx, try},
		BottomRight: Point{brx, bry},
		BottomLeft:  Point{blx, bly},
	}
}
781729
func (bb BoundingBox) Geometry() interface{} {
	var result interface{}
	switch len(bb) {
	case 4:
		if (bb[0] == bb[2]) && (bb[1] == bb[3]) {
			result = NewPoint(bb[0:2])
		} else {
			coordinates := make([][][]float64, 1)
			coordinates[0] = make([][]float64, 5)
			coordinates[0][0] = make([]float64, 2)
			coordinates[0][0][0] = bb[0]
			coordinates[0][0][1] = bb[1]
			coordinates[0][1] = make([]float64, 2)
			coordinates[0][1][0] = bb[2]
			coordinates[0][1][1] = bb[1]
			coordinates[0][2] = make([]float64, 2)
			coordinates[0][2][0] = bb[2]
			coordinates[0][2][1] = bb[3]
			coordinates[0][3] = make([]float64, 2)
			coordinates[0][3][0] = bb[0]
			coordinates[0][3][1] = bb[3]
			coordinates[0][4] = make([]float64, 2)
			coordinates[0][4][0] = bb[0]
			coordinates[0][4][1] = bb[1]
			result = NewPolygon(coordinates)
		}
	}
	return result
}
177643
func (b Box) Center() (x, y int) {
	w2, h2 := b.Width()>>1, b.Height()>>1
	return b.Left + w2, b.Top + h2
}
104336
func (fc *FeatureCollection) ForceBbox() BoundingBox {
	if len(fc.Bbox) > 0 {
		return fc.Bbox
	}
	var result BoundingBox
	for _, feature := range fc.Features {
		result = mergeBboxes(result, feature.ForceBbox())
	}
	return result
}
71263
func Joined(a, b *Box) Box {
	var joined Box
	joined.Min = Min(&a.Min, &b.Min)
	joined.Max = Max(&a.Max, &b.Max)
	return joined
}
234748
func (k PrecomputedSharedKey) Unbox(nonce saltpack.Nonce, msg []byte) ([]byte, error) {
	ret, ok := box.OpenAfterPrecomputation([]byte{}, msg, (*[24]byte)(&nonce), (*[32]byte)(&k))
	if !ok {
		return nil, saltpack.ErrDecryptionFailed
	}
	return ret, nil
}
613513
func geoBoundingBox(hash string) geoBox {
	bits := uint(5 * len(hash))
	inthash := base32encoding.decode(hash)
	return geoBoundingBoxIntWithPrecision(inthash, bits)
}
246376
func (b *BoxLayout) Resize() {
	b.layout()

	// Now also let the children know we resized.
	for i := range b.cells {
		b.cells[i].widget.Resize()
	}
	b.PostEventWidgetResize(b)
}
542262
func (v *Box) PackStartDefaults(child IWidget) {
	deprecated_since(2, 14, 0, "gtk_box_pack_start_defaults()")
	C.gtk_box_pack_start_defaults(BOX(v), ToNative(child))
}
748100
func (bc BoxCorners) Center() (x, y int) {

	left := util.Math.MeanInt(bc.TopLeft.X, bc.BottomLeft.X)
	right := util.Math.MeanInt(bc.TopRight.X, bc.BottomRight.X)
	x = ((right - left) >> 1) + left

	top := util.Math.MeanInt(bc.TopLeft.Y, bc.TopRight.Y)
	bottom := util.Math.MeanInt(bc.BottomLeft.Y, bc.BottomRight.Y)
	y = ((bottom - top) >> 1) + top

	return
}
1068463
func (b *Box) Insert(i int, w Widget) {
	if len(b.children) < i || i < 0 {
		return
	}

	b.children = append(b.children, nil)
	copy(b.children[i+1:], b.children[i:])
	b.children[i] = w
}