• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1951
  • Last Modified:

How to determine if a point is on the left or right of a given line

Hello,
This is a math / geometry question really.

I am trying to find out if a given coordinate (x0,y0) is on the left or right of a line formed by two other points (x1,y1) and (x2, y2).

I am sure its simple geometry, but if you don't know it, its not so simple :).
0
HRCIII
Asked:
HRCIII
  • 2
1 Solution
 
sdstuberCommented:
determine  x =   (y0-y1)(x2-x1)/(y2-y1) + x1

if x < x0 then point is right of line
if x= x0 then point is on line
if x > x0 then point is left of line
0
 
HRCIIIAuthor Commented:
Thank you,

This works beautifully and saves me a major amount of time.

-HRC
0
 
sdstuberCommented:
glad I could help
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now