pack3d

package
v0.0.0-...-ef50101 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Rotations []fauxgl.Matrix

Functions

This section is empty.

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, 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
	RotAllowed  bool
}

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, rotAllowed bool)

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, callback AnnealCallback) *Model

func (*Model) Reset

func (m *Model) Reset()

func (*Model) Transformations

func (m *Model) Transformations() []fauxgl.Matrix

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