18 lines
476 B
Go
18 lines
476 B
Go
package gg
|
|
|
|
// The type describes a simple
|
|
// rectangle without transformations.
|
|
type Size struct {
|
|
// The upper left corner position point.
|
|
Position Point
|
|
// Absolute width and height.
|
|
// Both must be positive values.
|
|
Width, Height Float
|
|
}
|
|
|
|
func (size Size) ContainsPoint(pt Point) bool {
|
|
return (size.Position.X < pt.X && (size.Position.X + size.Width) > pt.X ) &&
|
|
(size.Position.Y < pt.Y && (size.Position.Y + size.Height) > pt.Y )
|
|
}
|
|
|
|
//type (s Size) ContainsPoint
|