geom

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEFAULT_SIZE = Vec2{
	R: 26,
	C: 80,
}
View Source
var UnitVec2 = Vec2{R: 1, C: 1}

Functions

func Abs added in v0.1.13

func Abs(value int) int

Abs returns the absolute value of an integer.

func AsUint16

func AsUint16(val int) uint16

func Clamp

func Clamp(value, min, max int) int

func Max

func Max(first int, second int) int

Max returns the largest integer

func Max16

func Max16(first int16, second int16) int16

Max16 returns the largest integer

func Max32

func Max32(first int32, second int32) int32

Max32 returns the largest 32-bit integer

func Min

func Min(first int, second int) int

Min returns the smallest integer

Types

type Rect

type Rect struct {
	Position, Size Vec2
}

func (Rect) BottomRight added in v0.1.11

func (r Rect) BottomRight() Vec2

Get the position of the bottom-right corner of the Rect.

func (Rect) Contains added in v0.1.6

func (r Rect) Contains(v Vec2) bool

type Size

type Size = Vec2

type Vec2

type Vec2 struct {

	// row (y)
	R int
	// column (x)
	C int
	// contains filtered or unexported fields
}

func GetMaximum

func GetMaximum(a, b Vec2) Vec2

Find the largest rectangle that both rectangle `a` and `b` can fit.

func NormalizeRange added in v0.1.13

func NormalizeRange(start, end Vec2) (newStart, newEnd Vec2)

func (Vec2) Add added in v0.1.5

func (v Vec2) Add(other Vec2) Vec2

func (Vec2) Center added in v0.1.10

func (v Vec2) Center(other Vec2) Vec2

Calculate the position that centers the rectangle described by `other` inside of the rectangle described by `v`.

func (Vec2) Clamp added in v0.1.5

func (v Vec2) Clamp(min, max Vec2) Vec2

func (Vec2) GT added in v0.1.13

func (v Vec2) GT(other Vec2) bool

func (Vec2) GTE added in v0.1.13

func (v Vec2) GTE(other Vec2) bool

func (Vec2) IsZero added in v0.1.5

func (v Vec2) IsZero() bool

func (Vec2) LT added in v0.1.13

func (v Vec2) LT(other Vec2) bool

func (Vec2) LTE added in v0.1.13

func (v Vec2) LTE(other Vec2) bool

func (Vec2) Scalar added in v0.1.5

func (v Vec2) Scalar(value int) Vec2

func (Vec2) Sub added in v0.1.5

func (v Vec2) Sub(other Vec2) Vec2

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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