There is a point $(x,y)$, and a rectangle $a(x_1,y_1),b(x_2,y_2),c(x_3,y_3),d(x_4,y_4)$, how can one check if the point inside the rectangle?
$M$ of coordinates $(x,y)$ is inside the rectangle iff
$$(0<\textbf{AM}\cdot \textbf{AB}<\textbf{AB}\cdot \textbf{AB}) \land (0<\textbf{AM}\cdot \textbf{AD}<\textbf{AD}\cdot \textbf{AD})$$ (scalar product of vectors)
I found this formula but I don't understand how I have to calculate it. I haven't done much math in a long time.
I don't understand why this is considered a duplicate when I'm asking how to solve the equation provided by the answer of that question.
Let us draw the picture of the rectangle:
First, $AB$ is the vector going from $A$ to $B$ (in fact, it is usually denoted by $\vec{AB}$); that is, if $A=(x_1,y_1)$ and $B=(x_2,y_2)$, then $$\vec{AB}=(x_2-x_1,y_2-y_1).$$ The others are analogous.
The operator $\cdot$ is the dot product, also called scalar product. The quantity $\vec{AM}\cdot \vec{AB}$ expresses how long is the projection of $\vec{AM}$ in the direction of $\vec{AB}$.
If $\vec{AM}\cdot \vec{AB}<0$, it means that they somehow have opposite senses, what can be interpreted as $M$ being outside the rectangle. Analogously, if $\vec{AM}\cdot \vec{AB}>\vec{AB}\cdot \vec{AB}$, then $M$ would also be outside, since the projection of $\vec{AM}$ would be longer than $\vec{AB}$.
The other restrictions can be interpreted in a similar way.