2024-05-28 11:24:12 +03:00
|
|
|
package mx
|
2024-01-16 01:08:21 +03:00
|
|
|
|
|
|
|
// 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
|
2024-01-16 01:08:21 +03:00
|
|
|
// Absolute width and height.
|
2024-01-22 10:23:47 +03:00
|
|
|
// Both must be positive values.
|
2024-01-16 01:08:21 +03:00
|
|
|
Width, Height Float
|
|
|
|
}
|
|
|
|
|
2024-05-28 11:24:12 +03:00
|
|
|
func (size Size) ContainsPoint(pt Vector) bool {
|
2024-01-22 10:23:47 +03:00
|
|
|
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 )
|
|
|
|
}
|
|
|
|
|
2024-01-16 01:08:21 +03:00
|
|
|
//type (s Size) ContainsPoint
|