spatial

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const BlockSize = 16
View Source
const BlockVolume = BlockSize * BlockSize * BlockSize

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockPosition

type BlockPosition struct {
	X, Y, Z int
}

BlockPosition is a block position in world space

func (BlockPosition) Add

func (BlockPosition) AddNode

func (lhs BlockPosition) AddNode(pos NodePosition) NodePosition

type Bounds

type Bounds struct {
	Min int `toml:"min"`
	Max int `toml:"max"`
}

Bounds defines the extent of a region on a single axis. It is assumed that Max is always greater or equal to Min.

type NodePosition

type NodePosition struct {
	X, Y, Z int
}

NodePosition is a node position in world space

func (NodePosition) Add

func (lhs NodePosition) Add(rhs NodePosition) NodePosition

func (NodePosition) Region

func (lhs NodePosition) Region() Region

type Region

type Region struct {
	XBounds Bounds `toml:"x_bounds"`
	YBounds Bounds `toml:"y_bounds"`
	ZBounds Bounds `toml:"z_bounds"`
}

Region defines an axis-aligned cuboid region in world space (units are nodes).

func (Region) Intersects

func (lhs Region) Intersects(rhs Region) bool

func (Region) IsAtEdge added in v0.0.2

func (lhs Region) IsAtEdge(pos NodePosition) bool

type TileRegion

type TileRegion struct {
	XBounds Bounds
	YBounds Bounds
}

TileRegion defines an axis-aligned rectangle region in tile space (units are tiles at zoom level 0). It's used to represent a projection of a Region onto the screen.

Jump to

Keyboard shortcuts

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