gg/mx/size.go

19 lines
478 B
Go
Raw Permalink Normal View History

2024-05-28 11:24:12 +03:00
package mx
// The type describes a simple
// rectangle without transformations.
type Size struct {
// The upper left corner position point.
2024-05-28 11:24:12 +03:00
Position Vector
// Absolute width and height.
// Both must be positive values.
Width, Height Float
}
2024-05-28 11:24:12 +03:00
func (size Size) ContainsPoint(pt Vector) 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