types

package
v0.0.0-...-b27d2ac Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NW = iota
	NE
	SW
	SE
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnySpatial

type AnySpatial[T constraints.Integer] interface {
	Bounds() Rect[T]
	Compare(other AnySpatial[T]) bool
}

type Packet

type Packet interface {
	Serialize(writer *stream.StreamWriter) error
	Deserialize(reader *stream.StreamReader)
	Opcode() uint16
}

type Point

type Point[T constraints.Integer] = Vector2[T]

type QuadTreeNode

type QuadTreeNode[T constraints.Integer, U AnySpatial[T]] struct {
	Bounds   Rect[T]
	Items    []U
	Children [4]*QuadTreeNode[T, U]
	Depth    int
}

func NewQuadTreeNode

func NewQuadTreeNode[T constraints.Integer, U AnySpatial[T]](bounds Rect[T], depth int) *QuadTreeNode[T, U]

func (*QuadTreeNode[T, U]) Find

func (n *QuadTreeNode[T, U]) Find(p Vector2[T]) (*U, bool)

func (*QuadTreeNode[T, U]) Insert

func (n *QuadTreeNode[T, U]) Insert(item U) bool

func (*QuadTreeNode[T, U]) QueryRange

func (n *QuadTreeNode[T, U]) QueryRange(r Rect[T], out *[]U)

func (*QuadTreeNode[T, U]) Relations

func (n *QuadTreeNode[T, U]) Relations(p Vector2[T]) []U

type Rect

type Rect[T constraints.Integer] struct {
	Left, Top, Right, Bottom T
}

func (Rect[T]) ContainsPoint

func (r Rect[T]) ContainsPoint(pos Point[T]) bool

func (Rect[T]) ContainsRect

func (r Rect[T]) ContainsRect(other Rect[T]) bool

func (Rect[T]) Intersects

func (r Rect[T]) Intersects(other Rect[T]) bool

type SendPolicy

type SendPolicy uint32
const (
	SEND_POLICY_RAW     SendPolicy = 0
	SEND_POLICY_ENCRYPT SendPolicy = 1 << iota
)

type Vector2

type Vector2[T constraints.Integer] struct {
	X, Y T
}

func (Vector2[T]) DistanceSq

func (v Vector2[T]) DistanceSq(other Vector2[T]) int64

Jump to

Keyboard shortcuts

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