If p is inside of rect, a copy of p is returned. If p is outside of rect, a point is returned closest to p on the edge of the rectangle.
p
rect
If
pis inside ofrect, a copy ofpis returned. Ifpis outside ofrect, a point is returned closest topon the edge of the rectangle.