geometry

package
v0.0.0-...-4a525b6 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Max

func Max(a, b int) int

func Min

func Min(a, b int) int

Types

type Point

type Point struct {
	X int
	Y int
}

func (*Point) Constrain

func (p *Point) Constrain(rect Rect)

func (*Point) Translate

func (p *Point) Translate(x, y int)

type Rect

type Rect struct {
	Position Point
	Size     Size
}

Rect holds four int coordinates describing the upper and lower bounds of a rectangle. Rect may be created from outer bounds or from position, width, and height.

func RectNewLTRB

func RectNewLTRB(left, top, right, bottom int) Rect

RectNewLTRB constructs a Rect from four coordinates.

func RectNewXYWH

func RectNewXYWH(x, y, width, height int) Rect

RectNewXYWH constructs a Rect from a Top Left coordinate (x, y) and dimensions (width and height).

func (Rect) Bottom

func (r Rect) Bottom() int

func (Rect) Clip

func (r Rect) Clip(other Rect) Rect

func (Rect) Right

func (r Rect) Right() int

func (Rect) Translate

func (r Rect) Translate(x, y int) Rect

func (Rect) TranslateForPos

func (r Rect) TranslateForPos(pos Point) Rect

type Size

type Size struct {
	Width  int
	Height int
}

func (Size) Max

func (d Size) Max(other Size) Size

func (Size) Min

func (d Size) Min(other Size) Size

Jump to

Keyboard shortcuts

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