blob: ad02eab56b326e4f83e9f44f4a414a5193e19017 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package structs
// BoundingBox is a struct defining the spatial outreach of a box
type BoundingBox struct {
center Vec2 // Center of the box
width float64 // width of the box
}
func (b *BoundingBox) Width() float64 {
return b.width
}
func (b *BoundingBox) SetWidth(width float64) {
b.width = width
}
func (b *BoundingBox) Center() Vec2 {
return b.center
}
func (b *BoundingBox) SetCenter(center Vec2) {
b.center = center
}
func NewBoundingBox(center Vec2, halfDim float64) *BoundingBox {
return &BoundingBox{center: center, width: halfDim}
}
|