How to check if a point is inside a rectangle?

There is a point (x,y), and a rectangle a(x1,y1),b(x2,y2),c(x3,y3),d(x4,y4), how can one check if the point inside the rectangle?

enter image description here

Answer

M of coordinates (x,y) is inside the rectangle iff

(0<AMAB<ABAB)(0<AMAD<ADAD)
(scalar product of vectors)

Attribution
Source : Link , Question Author : Freewind , Answer Author :
2 revs

Leave a Comment