geom

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2018 License: MPL-2.0 Imports: 2 Imported by: 61

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Insets

type Insets struct {
	Top    float64
	Left   float64
	Bottom float64
	Right  float64
}

Insets defines margins on each side of a rectangle.

func NewHorizontalInsets

func NewHorizontalInsets(amount float64) Insets

NewHorizontalInsets creates a new Insets whose left and right edges have the specified value.

func NewUniformInsets

func NewUniformInsets(amount float64) Insets

NewUniformInsets creates a new Insets whose edges all have the same value.

func NewVerticalInsets

func NewVerticalInsets(amount float64) Insets

NewVerticalInsets creates a new Insets whose top and bottom edges have the specified value.

func (*Insets) Add

func (i *Insets) Add(insets Insets)

Add modifies this Insets by adding the supplied Insets.

func (Insets) String

func (i Insets) String() string

String implements the fmt.Stringer interface.

type Point

type Point struct {
	X, Y float64
}

Point defines a location.

func (*Point) Add

func (p *Point) Add(pt Point)

Add modifies this Point by adding the supplied coordinates.

func (*Point) Align

func (p *Point) Align()

Align modifies this Point to align with integer coordinates.

func (Point) String

func (p Point) String() string

String implements the fmt.Stringer interface.

func (*Point) Subtract

func (p *Point) Subtract(pt Point)

Subtract modifies this Point by subtracting the supplied coordinates.

type Rect

type Rect struct {
	Point
	Size
}

Rect defines a rectangle.

func (*Rect) Align

func (r *Rect) Align()

Align modifies this rectangle to align with integer coordinates that would encompass the original rectangle.

func (*Rect) CenterX

func (r *Rect) CenterX() float64

CenterX returns the center x-coordinate of the rectangle.

func (*Rect) CenterY

func (r *Rect) CenterY() float64

CenterY returns the center y-coordinate of the rectangle.

func (*Rect) ContainsPoint

func (r *Rect) ContainsPoint(pt Point) bool

ContainsPoint returns true if the coordinates are within the Rect.

func (*Rect) ContainsRect

func (r *Rect) ContainsRect(in Rect) bool

ContainsRect returns true if this Rect fully contains the passed in Rect.

func (*Rect) CopyAndZeroLocation

func (r *Rect) CopyAndZeroLocation() Rect

CopyAndZeroLocation creates a new copy of the Rect and sets the location of the copy to 0,0.

func (*Rect) Inset

func (r *Rect) Inset(insets Insets)

Inset this Rect by the specified Insets.

func (*Rect) InsetUniform

func (r *Rect) InsetUniform(amount float64)

InsetUniform insets this Rect by the specified amount on all sides. Positive values make the Rect smaller, while negative values make it larger.

func (*Rect) Intersect

func (r *Rect) Intersect(other Rect)

Intersect this Rect with another Rect, storing the result into this Rect.

func (*Rect) IsEmpty

func (r *Rect) IsEmpty() bool

IsEmpty returns true if either the width or height is zero or less.

func (Rect) String

func (r Rect) String() string

String implements the fmt.Stringer interface.

func (*Rect) Union

func (r *Rect) Union(other Rect)

Union this Rect with another Rect, storing the result into this Rect.

type Size

type Size struct {
	Width, Height float64
}

Size defines a width and height.

func (*Size) Add

func (s *Size) Add(size Size)

Add modifies this Size by adding the supplied Size.

func (*Size) AddInsets

func (s *Size) AddInsets(insets Insets)

AddInsets modifies this Size by expanding it to accommodate the specified insets.

func (*Size) ConstrainForHint

func (s *Size) ConstrainForHint(hint Size)

ConstrainForHint ensures this size is no larger than the hint. Hint values less than zero are ignored.

func (*Size) GrowToInteger

func (s *Size) GrowToInteger()

GrowToInteger modifies this Size such that its width and height are both the smallest integers greater than or equal to their original values.

func (*Size) Max

func (s *Size) Max(other Size)

Max modifies this Size to contain the largest values between itself and 'other'.

func (*Size) Min

func (s *Size) Min(other Size)

Min modifies this Size to contain the smallest values between itself and 'other'.

func (Size) String

func (s Size) String() string

String implements the fmt.Stringer interface.

func (*Size) Subtract

func (s *Size) Subtract(size Size)

Subtract modifies this Size by subtracting the supplied Size.

func (*Size) SubtractInsets

func (s *Size) SubtractInsets(insets Insets)

SubtractInsets modifies this Size by reducing it to accommodate the specified insets.

Jump to

Keyboard shortcuts

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