Documentation ¶
Overview ¶
Package geom provides geometry primitives.
Index ¶
- type Insets
- type Point
- type Rect
- func (r *Rect) Align()
- func (r Rect) CenterX() float64
- func (r Rect) CenterY() float64
- func (r Rect) ContainsPoint(pt Point) bool
- func (r Rect) ContainsRect(in Rect) bool
- func (r *Rect) CopyAndZeroLocation() Rect
- func (r *Rect) Inset(insets Insets)
- func (r *Rect) InsetUniform(amount float64)
- func (r *Rect) Intersect(other Rect)
- func (r Rect) Intersects(other Rect) bool
- func (r Rect) IsEmpty() bool
- func (r Rect) String() string
- func (r *Rect) Union(other Rect)
- type Size
- func (s *Size) Add(size Size)
- func (s *Size) AddInsets(insets Insets)
- func (s *Size) ConstrainForHint(hint Size)
- func (s *Size) GrowToInteger()
- func (s *Size) Max(other Size)
- func (s *Size) Min(other Size)
- func (s Size) String() string
- func (s *Size) Subtract(size Size)
- func (s *Size) SubtractInsets(insets Insets)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Insets ¶
Insets defines margins on each side of a rectangle.
func NewHorizontalInsets ¶
NewHorizontalInsets creates a new Insets whose left and right edges have the specified value.
func NewUniformInsets ¶
NewUniformInsets creates a new Insets whose edges all have the same value.
func NewVerticalInsets ¶
NewVerticalInsets creates a new Insets whose top and bottom edges have the specified value.
type Point ¶
type Point struct {
X, Y float64
}
Point defines a location.
func NewPointPtr ¶ added in v1.8.0
NewPointPtr creates a new *Point.
type Rect ¶
Rect defines a rectangle.
func NewRectPtr ¶ added in v1.8.0
NewRectPtr creates a new *Rect.
func (*Rect) Align ¶
func (r *Rect) Align()
Align modifies this rectangle to align with integer coordinates that would encompass the original rectangle.
func (Rect) ContainsPoint ¶
ContainsPoint returns true if the coordinates are within the Rect.
func (Rect) ContainsRect ¶
ContainsRect returns true if this Rect fully contains the passed in Rect.
func (*Rect) CopyAndZeroLocation ¶
CopyAndZeroLocation creates a new copy of the Rect and sets the location of the copy to 0,0.
func (*Rect) InsetUniform ¶
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) Intersects ¶ added in v1.6.0
Intersects returns true if this rect and the other rect intersect.
type Size ¶
type Size struct {
Width, Height float64
}
Size defines a width and height.
func NewSizePtr ¶ added in v1.8.0
NewSizePtr creates a new *Size.
func (*Size) AddInsets ¶
AddInsets modifies this Size by expanding it to accommodate the specified insets.
func (*Size) ConstrainForHint ¶
ConstrainForHint ensures this size is no larger than the hint. Hint values less than one 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) Min ¶
Min modifies this Size to contain the smallest values between itself and 'other'.
func (*Size) SubtractInsets ¶
SubtractInsets modifies this Size by reducing it to accommodate the specified insets.