Documentation ¶
Overview ¶
Geometry utilities.
Index ¶
- type Rectangle
- func (r Rectangle) Area() int
- func (r Rectangle) Bottom() int
- func (r Rectangle) BottomLeft() Vec2D
- func (r Rectangle) BottomRight() Vec2D
- func (r Rectangle) Contains(p Vec2D) bool
- func (r Rectangle) GrowBottom(n int) Rectangle
- func (r Rectangle) GrowLeft(n int) Rectangle
- func (r Rectangle) GrowRight(n int) Rectangle
- func (r Rectangle) GrowTop(n int) Rectangle
- func (r Rectangle) Left() int
- func (r Rectangle) MoveBy(n Vec2D) Rectangle
- func (r Rectangle) Right() int
- func (r Rectangle) ShrinkBottom(n int) Rectangle
- func (r Rectangle) ShrinkLeft(n int) Rectangle
- func (r Rectangle) ShrinkRight(n int) Rectangle
- func (r Rectangle) ShrinkTop(n int) Rectangle
- func (r Rectangle) Size() Size
- func (r Rectangle) Top() int
- func (r Rectangle) TopLeft() Vec2D
- func (r Rectangle) TopRight() Vec2D
- type Size
- type Sized
- type Vec2D
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rectangle ¶
type Rectangle struct { // Top Left corner of rectangle. Origin Vec2D // RectSize define size of rectangle. RectSize Size }
Rectangle define a rectangle with two 2D vectors for the minimum (top-left corner) and the maximum (bottom-right corner).
func (Rectangle) BottomLeft ¶
BottomLeft returns position of bottom left corner.
func (Rectangle) BottomRight ¶
BottomRight returns position of bottom right corner.
func (Rectangle) GrowBottom ¶
GrowBottom returns a new rectangle with bottom edge moved by n unit to the bottom.
func (Rectangle) GrowLeft ¶
GrowLeft returns a new rectangle with left edge moved by n unit to the left.
func (Rectangle) GrowRight ¶
GrowRight returns a new rectangle with right edge moved by n unit to the right.
func (Rectangle) GrowTop ¶
GrowTop returns a new rectangle with top edge moved by n unit to the top.
func (Rectangle) ShrinkBottom ¶
ShrinkBottom returns a new rectangle with bottom edge moved by n unit to the top.
func (Rectangle) ShrinkLeft ¶
ShrinkLeft returns a new rectangle with left edge moved by n unit to the right.
func (Rectangle) ShrinkRight ¶
ShrinkRight returns a new rectangle with right edge moved by n unit to the left.
func (Rectangle) ShrinkTop ¶
ShrinkTop returns a new rectangle with top edge moved by n unit to the bottom.