If parallel to Y - axis
if ( p1 . first == p2 . first && p1 . first == p . first ) { if ( p . second <= Math . Max ( p1 . second , p2 . second ) && ( p . second >= Math . Min ( p1 . second , p2 . second ) ) )