geometry

package
v0.0.0-...-4486ec2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Box

type Box struct {
	// contains filtered or unexported fields
}

func BoxZero

func BoxZero() Box

func NewBox

func NewBox(a, b Vector2) Box

Define a box by two opposite corner points

func (Box) Area

func (a Box) Area() int

func (Box) BotLeft

func (a Box) BotLeft() Vector2

func (Box) BotRight

func (a Box) BotRight() Vector2

func (Box) Center

func (a Box) Center() Vector2

func (Box) CollideWith

func (a Box) CollideWith(b Box) bool

func (Box) Contains

func (a Box) Contains(p Vector2) bool

func (Box) Offset

func (a Box) Offset(p Vector2) Box

func (Box) SizeX

func (a Box) SizeX() int

func (Box) SizeY

func (a Box) SizeY() int

func (Box) TopLeft

func (a Box) TopLeft() Vector2

func (Box) TopRight

func (a Box) TopRight() Vector2

type Direction

type Direction int
const (
	Up Direction = iota
	Right
	Down
	Left
)

func (Direction) ClockCount

func (self Direction) ClockCount(count int) Direction

func (Direction) Clockwise

func (self Direction) Clockwise() Direction

func (Direction) CounterClockwise

func (self Direction) CounterClockwise() Direction

func (Direction) Opposite

func (self Direction) Opposite() Direction

func (Direction) ToVector2

func (self Direction) ToVector2() Vector2

func (Direction) ToVector3

func (self Direction) ToVector3() Vector3

type Vector2

type Vector2 struct {
	X, Y int
}

func Vector2One

func Vector2One() Vector2

func Vector2Zero

func Vector2Zero() Vector2

func (Vector2) Add

func (a Vector2) Add(b Vector2) Vector2

func (Vector2) DirectionTo

func (a Vector2) DirectionTo(b Vector2) Direction

func (Vector2) Distance

func (a Vector2) Distance(b Vector2) int

func (Vector2) Div

func (a Vector2) Div(i int) Vector2

func (Vector2) Length

func (a Vector2) Length() int

func (Vector2) Lerp

func (a Vector2) Lerp(b Vector2, i float32) Vector2

func (Vector2) LineBresenham

func (a Vector2) LineBresenham(b Vector2, width int) []Vector2

NOTE: width is currently unimplemented

func (Vector2) LineHV

func (a Vector2) LineHV(b Vector2, width int) []Vector2

Horizontal then Vertical line

func (Vector2) LineVH

func (a Vector2) LineVH(b Vector2, width int) []Vector2

Vertical then Horizontal line

func (Vector2) LookingAt

func (a Vector2) LookingAt(b Vector2, dir Direction) bool

func (Vector2) Minus

func (a Vector2) Minus(b Vector2) Vector2

func (Vector2) Mod

func (a Vector2) Mod(i int) Vector2

func (Vector2) Mul

func (a Vector2) Mul(i int) Vector2

func (Vector2) Neighbors

func (a Vector2) Neighbors() [4]Vector2

func (Vector2) Rotate

func (a Vector2) Rotate(dir Direction) Vector2

func (Vector2) Sum

func (a Vector2) Sum(other ...Vector2) Vector2

func (Vector2) ToString

func (a Vector2) ToString() string

type Vector3

type Vector3 struct {
	X, Y, Z int
}

func Vector3One

func Vector3One() Vector3

func Vector3Zero

func Vector3Zero() Vector3

func (Vector3) Add

func (a Vector3) Add(b Vector3) Vector3

func (Vector3) Div

func (a Vector3) Div(i int) Vector3

func (Vector3) Lerp

func (a Vector3) Lerp(b Vector3, i float32) Vector3

func (Vector3) Minus

func (a Vector3) Minus(b Vector3) Vector3

func (Vector3) Mod

func (a Vector3) Mod(i int) Vector3

func (Vector3) Mul

func (a Vector3) Mul(i int) Vector3

func (Vector3) Sum

func (a Vector3) Sum(other ...Vector3) Vector3

func (Vector3) ToString

func (a Vector3) ToString() string

Jump to

Keyboard shortcuts

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