Documentation ¶
Index ¶
- type Bin
- type BinBoundary
- type Container
- func (c *Container) GetEmptyArea() float64
- func (c *Container) GetEmptyBins() []*Bin
- func (c *Container) Insert(object interface{}, boundary BinBoundary) (bool, Bin)
- func (c *Container) InsertWithPadding(object interface{}, boundary BinBoundary, padding float64) (bool, Bin)
- func (c *Container) IsEmpty() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bin ¶
type Bin struct { Width float64 Height float64 X float64 Y float64 Object interface{} // Packable BinPackable Rotated bool // if true this should be rotated by 90deg HasObject bool HasChildren bool LeftChild *Bin RightChild *Bin }
func (*Bin) Insert ¶
func (b *Bin) Insert(object interface{}, boundary BinBoundary) (bool, *Bin)
Recursively attempts to add the packable in the bin returns (true, bin) or (false, nil)
func (*Bin) IsHorizontalSplit ¶
is this split on the horizontal axis: i.e. left means top, right means bottom
type BinBoundary ¶
type Container ¶
func NewContainer ¶
func NewSingleObjectContainer ¶
func NewSingleObjectContainer(obj interface{}, x float64, y float64, width float64, height float64) *Container
creates a new container with a single element. It will not be possible to add to this container.
func (*Container) GetEmptyArea ¶
returns the total area in unit^2 of emptyness
func (*Container) GetEmptyBins ¶
finds all the empty bins, useful for finding how much space is left over
func (*Container) Insert ¶
func (c *Container) Insert(object interface{}, boundary BinBoundary) (bool, Bin)
Inserts the packable into the container and returns the bin it was placed in if possible
func (*Container) InsertWithPadding ¶
func (c *Container) InsertWithPadding(object interface{}, boundary BinBoundary, padding float64) (bool, Bin)
inserts into the container with the specified padding on all sides
Click to show internal directories.
Click to hide internal directories.