Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item struct {
Name string `json:"name"`
Width int64 `json:"width"`
Height int64 `json:"height"`
}
Item describes a single item we want to pack on a sheet
type NoSolutionError ¶
NoSolutionError indicates that a problem has no solution
func (*NoSolutionError) Error ¶
func (e *NoSolutionError) Error() string
type PackedItem ¶
PackedItem is an item placed somewhere in space
func (*PackedItem) SVG ¶
func (p *PackedItem) SVG() string
SVG produces an SVG representation of this item
type PackedSheet ¶
type PackedSheet struct {
Sheet
Items []PackedItem `json:"items"`
}
PackedSheet contains a set of items aranged on a sheet
func (*PackedSheet) SVG ¶
func (s *PackedSheet) SVG() string
SVG produces an SVG representation of this sheet
type Sheet ¶
type Sheet struct {
Width int64 `json:"width"`
// Height is the height of the sheet in units. If zero we'll pack a single infinite sheet
Height int64 `json:"height,omitempty"`
}
Sheet describes the container we want to pack the items on
type Solution ¶
type Solution struct {
Sheets []PackedSheet `json:"sheet"`
Cost int64 `json:"cost"`
}
Solution has the items packed on sheets
func FirstFitDecreasingHeight ¶
FirstFitDecreasingHeight implements the first-fit-decreasing-height algorithm of Performance Bounds for Level-Oriented Two-Dimensional Packing Algorithms E. G. Coffman, Jr., M. R. Garey, D. S. Johnson, and R. E. Tarjan SIAM Journal on Computing 1980 9:4, 808-826
func NextFitDecreasingHeight ¶
NextFitDecreasingHeight implements the next-fit-decreasing-height algorithm of Performance Bounds for Level-Oriented Two-Dimensional Packing Algorithms E. G. Coffman, Jr., M. R. Garey, D. S. Johnson, and R. E. Tarjan SIAM Journal on Computing 1980 9:4, 808-826