Check if the point is in the rectangle

I have image.Point and image.Rectangle . I would like to know how to check if a point is in a rectangle. I know that I can check manually:

 p := image.Point{} r := image.Rect{} if r.Min.X <= pX && pX < r.Max.X && r.Min.Y <= pY && pY < r.Max.Y { // Point is in the rectangle! } 

But this is pain! Is there a better way to do this? I can not find Contains() in the documentation .

+5
source share
1 answer
+4
source

All Articles