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?
Answer
M of coordinates (x,y) is inside the rectangle iff
(0<AM⋅AB<AB⋅AB)∧(0<AM⋅AD<AD⋅AD)
(scalar product of vectors)
Attribution
Source : Link , Question Author : Freewind , Answer Author :
2 revs