I need to create a function that checks whether a point is inside a polygon. For that, I researched the internet some solutions that could help me. I found one that seems to be of great help, but in one of the functions needed to run the main function, there was an error. The function is as follows:
// A função checa se o ponto Q está no segmento PR.
bool NoSegmento(Ponto P, Ponto Q, Ponto R)
{
if (Q.x <= max(P.x, R.x) && Q.x >= min(P.x, R.x) && Q.y <= max(P.y, R.y)
&& Q.y >= min(P.y, R.y))
return true;
return false;
}
However, when compiling, I get some warnings and errors, for example:
implicit declaration of function 'max' [-Wimplicit-function-declaration]|
implicit declaration of function 'min' [-Wimplicit-function-declaration]|
undefined reference to 'max'|
undefined reference to 'min'|
I would like to know if the MAX and MIN functions are functions of some library and what is the purpose of sweating the bool type for the function.