Hi All,
I am trying to check the location of a point(px, py) on 2D graph in relation to a line segment (lx1, ly1) (lx2, ly2), using logic of North South East West directions. The logic I have implemented is to draw a perpendicular on the line segment from the point.
if perpendicular is on line that means its south.
If point on right side means its East.
If point on left side means West.
If perpendicular is away from line in forward direction will mean North.
If perpendicular is away from line in backward direction will mean South.
My problem is that this logic looks good on paper, but its getting really hard to decide whether its a NW, NE, SW or SE case. Can anyone suggest me how to compute this logic?? I am using C++, but algorithm in any language will be a great help.
I am using end point of line segment to calculate North South East West relation.
Cheers