How determine any point is in the rectangle range?

Hello everybody!

General quadrilateral:
_rect =  display.newRect( display.contentCenterX, display.contentCenterY, 300, 300 );
_rect.halfW = _rect.width / 2;
_rect.halfH = _rect.height / 2;
_rect.l = _rect.x -  _rect.halfW;
_rect.r = _rect.x +  _rect.halfW;
_rect.t = _rect.y -  _rect.halfH;
_rect.b = _rect.y +  _rect.halfH;
if mX > _rect.l and mY < _rect.r and mY > rect.b and mY < rect.t then
    print( “hit” );
end

But if triangle or polygon or non rule rectangle, How to achieve code?

Thank you!

This is one approach: http://alienryderflex.com/polygon/

HI memo
Thank you!

but I do not understand the principle ,
I study,  
if have question, then please teach me,
very thank you!

This is one approach: http://alienryderflex.com/polygon/

HI memo
Thank you!

but I do not understand the principle ,
I study,  
if have question, then please teach me,
very thank you!