Documentation
¶
Index ¶
- func AddWalk(dag *RoomDag, roomPos map[string]tile.TilePosition, rng *rand.Rand, ...)
- func AnyEdgesIntersect(dag *RoomDag, rects map[string]RoomPlacement) bool
- func AxisAligned(tol int, a, b tile.Rect) bool
- func CalculateRoomDepths(dag *RoomDag, placements map[string]RoomPlacement, start string)
- func FindNodeNeighborAveragePosition(dag *RoomDag, place map[string]RoomPlacement, label string) tile.TilePosition
- func GetList[T any](list []T) (T, bool)
- func HasAnyRectIntersections(rects map[string]RoomPlacement) bool
- func HasEdgeIntersections(dag *RoomDag, rects map[string]RoomPlacement, label1, label2 string) bool
- func HasRectIntersections(rects map[string]RoomPlacement, label string) bool
- func ListItem[T any](rng *rand.Rand, list []T) (T, bool)
- func NodeHasEdgeIntersections(dag *RoomDag, rects map[string]RoomPlacement, label string) bool
- func NodeHasEdgeIntersectionsWithMoreShallowEdge(dag *RoomDag, placements map[string]RoomPlacement, label string) bool
- func PSLD(rng *rand.Rand, dag *RoomDag, place map[string]RoomPlacement)
- func PSLDStep(rng *rand.Rand, dag *RoomDag, place map[string]RoomPlacement) bool
- func Path(start, end vec2.T, n int, variation float64) []vec2.T
- func PlaceBreadthFirst(rng *rand.Rand, dag *RoomDag, rooms map[string]RoomPlacement, start string, ...)
- func PlaceDepthFirst(rng *rand.Rand, dag *RoomDag, rooms map[string]RoomPlacement, start string, ...)
- func RandomPositionInRect(r glm.Rect) glm.Vec2
- func Untangle(dag *RoomDag, rooms map[string]RoomPlacement, ...)
- func Wiggle(dag *RoomDag, rooms map[string]RoomPlacement, ...) bool
- type BreadthFirstLayout
- type DepthFirstLayout
- type ForceBasedRelaxer
- type GridLayout
- func (l *GridLayout) AllEdgesAxisAligned(tolerance int) bool
- func (l *GridLayout) Expand() bool
- func (l *GridLayout) Iterate() bool
- func (l *GridLayout) IterateGravity() bool
- func (l *GridLayout) IterateTowardsParent() bool
- func (l *GridLayout) LayoutGrid(roomPos map[string]tile.TilePosition)
- func (l *GridLayout) MoveTowards(rect tile.Rect, pos tile.TilePosition, dist int) tile.Rect
- type Item
- type NoiseMap
- type Octave
- type Range
- type RoomDag
- func BlankWalkDag() (*RoomDag, map[string]tile.TilePosition)
- func GenerateRandomGridWalkDag2(rng *rand.Rand, numRooms int, numWalks int) (*RoomDag, map[string]tile.TilePosition)
- func GenerateRandomGridWalkDagNoOverlap(rng *rand.Rand, numRooms int, numWalks int) (*RoomDag, map[string]tile.TilePosition)
- func NewRoomDag() *RoomDag
- func (d *RoomDag) AddEdge(from, to string)
- func (d *RoomDag) AddNode(label string) bool
- func (d *RoomDag) Distance(from, to string) int
- func (d *RoomDag) GetLeafNodes() []string
- func (d *RoomDag) HasEdge(from, to string) bool
- func (d *RoomDag) HasEdgeEitherDirection(from, to string) bool
- func (d *RoomDag) IsLeafNode(label string) bool
- func (d *RoomDag) RandomLabel(rng *rand.Rand) string
- func (d *RoomDag) RandomSortedLabel(startLabel string, rng *rand.Rand, topoAfter, topoBeforeEnd int) string
- func (d *RoomDag) TopologicalSort(start string) []string
- type RoomPlacement
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnyEdgesIntersect ¶
func AnyEdgesIntersect(dag *RoomDag, rects map[string]RoomPlacement) bool
func CalculateRoomDepths ¶
func CalculateRoomDepths(dag *RoomDag, placements map[string]RoomPlacement, start string)
func FindNodeNeighborAveragePosition ¶
func FindNodeNeighborAveragePosition(dag *RoomDag, place map[string]RoomPlacement, label string) tile.TilePosition
func HasAnyRectIntersections ¶
func HasAnyRectIntersections(rects map[string]RoomPlacement) bool
func HasEdgeIntersections ¶
func HasEdgeIntersections(dag *RoomDag, rects map[string]RoomPlacement, label1, label2 string) bool
func HasRectIntersections ¶
func HasRectIntersections(rects map[string]RoomPlacement, label string) bool
func NodeHasEdgeIntersections ¶
func NodeHasEdgeIntersections(dag *RoomDag, rects map[string]RoomPlacement, label string) bool
func NodeHasEdgeIntersectionsWithMoreShallowEdge ¶
func NodeHasEdgeIntersectionsWithMoreShallowEdge(dag *RoomDag, placements map[string]RoomPlacement, label string) bool
func PlaceBreadthFirst ¶
func PlaceDepthFirst ¶
Types ¶
type BreadthFirstLayout ¶
type BreadthFirstLayout struct {
// contains filtered or unexported fields
}
func NewBreadthFirstLayout ¶
func NewBreadthFirstLayout(rng *rand.Rand, dag *RoomDag, place map[string]RoomPlacement, start string, distance float64) *BreadthFirstLayout
func (*BreadthFirstLayout) Iterate ¶
func (d *BreadthFirstLayout) Iterate() bool
Returns true to indicate it hasn't finished
func (*BreadthFirstLayout) Reset ¶
func (d *BreadthFirstLayout) Reset()
type DepthFirstLayout ¶
type DepthFirstLayout struct {
// contains filtered or unexported fields
}
func NewDepthFirstLayout ¶
func NewDepthFirstLayout(rng *rand.Rand, dag *RoomDag, place map[string]RoomPlacement, start string, distance float64) *DepthFirstLayout
func (*DepthFirstLayout) Cut ¶
func (d *DepthFirstLayout) Cut(label string)
func (*DepthFirstLayout) CutBelow ¶
func (d *DepthFirstLayout) CutBelow(label string)
func (*DepthFirstLayout) CutCrossed ¶
func (d *DepthFirstLayout) CutCrossed() bool
func (*DepthFirstLayout) Iterate ¶
func (d *DepthFirstLayout) Iterate() bool
Returns true to indicate it hasn't finished
func (*DepthFirstLayout) Reset ¶
func (d *DepthFirstLayout) Reset()
type ForceBasedRelaxer ¶
type ForceBasedRelaxer struct {
// contains filtered or unexported fields
}
func NewForceBasedRelaxer ¶
func NewForceBasedRelaxer(rng *rand.Rand, dag *RoomDag, placements map[string]RoomPlacement, startingRepel float64, startingGrav float64) *ForceBasedRelaxer
func (*ForceBasedRelaxer) Iterate ¶
func (r *ForceBasedRelaxer) Iterate()
type GridLayout ¶
type GridLayout struct {
// contains filtered or unexported fields
}
func NewGridLayout ¶
func NewGridLayout(rng *rand.Rand, dag *RoomDag, place map[string]RoomPlacement, start string, tolerance int) *GridLayout
func (*GridLayout) AllEdgesAxisAligned ¶
func (l *GridLayout) AllEdgesAxisAligned(tolerance int) bool
TODO: tolerance?
func (*GridLayout) Expand ¶
func (l *GridLayout) Expand() bool
func (*GridLayout) Iterate ¶
func (l *GridLayout) Iterate() bool
func (*GridLayout) IterateGravity ¶
func (l *GridLayout) IterateGravity() bool
func (*GridLayout) IterateTowardsParent ¶
func (l *GridLayout) IterateTowardsParent() bool
func (*GridLayout) LayoutGrid ¶
func (l *GridLayout) LayoutGrid(roomPos map[string]tile.TilePosition)
func (*GridLayout) MoveTowards ¶
func (l *GridLayout) MoveTowards(rect tile.Rect, pos tile.TilePosition, dist int) tile.Rect
type RoomDag ¶
type RoomDag struct { Nodes []string // Holds the nodes in the order that they were added NodeMap map[string]int // holds the rank of the node (to prevent cycles) Edges map[string][]string // This is the dag // contains filtered or unexported fields }
TODO: Dump string labels and use int labels?
func BlankWalkDag ¶
func BlankWalkDag() (*RoomDag, map[string]tile.TilePosition)
func NewRoomDag ¶
func NewRoomDag() *RoomDag
func (*RoomDag) Distance ¶
Counts and returns the number of edges needed to traverse to get from one node to another
func (*RoomDag) GetLeafNodes ¶
Returns true if the node is a leaf node (ie has no outward facing edges)
func (*RoomDag) HasEdgeEitherDirection ¶
func (*RoomDag) IsLeafNode ¶
Returns true if the node is a leaf node (ie has no outward facing edges)
func (*RoomDag) RandomSortedLabel ¶
func (*RoomDag) TopologicalSort ¶
returns the node labels in topological order
type RoomPlacement ¶
Click to show internal directories.
Click to hide internal directories.