pack3d

package
v0.0.0-...-f068213 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Rotations []fauxgl.Matrix

Functions

func CreateRotations

func CreateRotations(lx bool, ly bool, lz bool, dax int, day int, daz int)

Types

type AnnealCallback

type AnnealCallback func(Annealable)

type Annealable

type Annealable interface {
	Energy() float64
	DoMove() Undo
	UndoMove(Undo)
	Copy() Annealable
}

func Anneal

func Anneal(state Annealable, maxTemp, minTemp float64, steps int, lx bool, ly bool, lz bool, ax int, ay int, az int, callback AnnealCallback) Annealable

type Axis

type Axis uint8
const (
	AxisNone Axis = iota
	AxisX
	AxisY
	AxisZ
)

func (Axis) Vector

func (a Axis) Vector() fauxgl.Vector

type Item

type Item struct {
	Mesh        *fauxgl.Mesh
	Trees       []Tree
	Rotation    int
	Translation fauxgl.Vector
}

func (*Item) Copy

func (item *Item) Copy() *Item

func (*Item) Matrix

func (item *Item) Matrix() fauxgl.Matrix

type Model

type Model struct {
	Items     []*Item
	MinVolume float64
	MaxVolume float64
	Deviation float64
}

func NewModel

func NewModel() *Model

func (*Model) Add

func (m *Model) Add(mesh *fauxgl.Mesh, detail, count int)

func (*Model) BoundingBox

func (m *Model) BoundingBox() fauxgl.Box

func (*Model) Copy

func (m *Model) Copy() Annealable

func (*Model) DoMove

func (m *Model) DoMove() Undo

func (*Model) Energy

func (m *Model) Energy() float64

func (*Model) Mesh

func (m *Model) Mesh() *fauxgl.Mesh

func (*Model) Meshes

func (m *Model) Meshes() []*fauxgl.Mesh

func (*Model) Pack

func (m *Model) Pack(iterations int, lx bool, ly bool, lz bool, ax int, ay int, az int, callback AnnealCallback) *Model

func (*Model) Reset

func (m *Model) Reset()

func (*Model) TreeMesh

func (m *Model) TreeMesh() *fauxgl.Mesh

func (*Model) TreeMeshes

func (m *Model) TreeMeshes() []*fauxgl.Mesh

func (*Model) UndoMove

func (m *Model) UndoMove(undo Undo)

func (*Model) ValidChange

func (m *Model) ValidChange(i int) bool

func (*Model) Volume

func (m *Model) Volume() float64

type Node

type Node struct {
	Box   fauxgl.Box
	Left  *Node
	Right *Node
}

func NewNode

func NewNode(boxes []fauxgl.Box, depth int) *Node

func (*Node) Flatten

func (a *Node) Flatten(tree Tree, i int)

func (*Node) Split

func (node *Node) Split(boxes []fauxgl.Box, depth int)

type Tree

type Tree []fauxgl.Box

func NewTreeForMesh

func NewTreeForMesh(mesh *fauxgl.Mesh, depth int) Tree

func (Tree) Intersects

func (a Tree) Intersects(b Tree, t1, t2 fauxgl.Vector) bool

func (Tree) Transform

func (a Tree) Transform(m fauxgl.Matrix) Tree

type Undo

type Undo struct {
	Index       int
	Rotation    int
	Translation fauxgl.Vector
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址