I have two points ( 0 , 0 ) and ( 93 , 3 )I'm...

Jonathan Miles

Jonathan Miles

Answered

2022-07-10

I have two points ( 0 , 0 ) and ( 93 , 3 )
I'm trying to work out whether a point is on or below the line segment defined by those two point.
Currently I'm using A x + B y + C = 0 to see if a point is on or below this line segment and this works correctly except for when the point is of the form ( 0 , y ) or ( x , 0 )
What am I doing wrong? Do I need to use a different form of the linear equation?

Answer & Explanation

Kroatujon3

Kroatujon3

Expert

2022-07-11Added 19 answers

For this particular example it would seem to be easier to write the equation for the line in slope-intercept form:
y = 1 31 x + 0
Then given any ( x , y ), you can test directly whether the point lies above or below the point on the line that has the same x coordinate.
delirija7z

delirija7z

Expert

2022-07-12Added 5 answers

Suppose your given points are ( x 1 , y 1 ) and ( x 2 , y 2 ). First get the slope m = y 1 y 2 x 1 x 2 . The equation of the line joining the points is y y 1 = m ( x x 1 ), where you just substitute x 1 , y 1 , and m. In slope intercept form the equation is
y = m x + ( y 1 m x 1 ) .
Given a point ( p , q ), first check that x 1 p x 2 . Then: q > m p + ( y 1 m x 1 ) means the point is above the segment, and q < m p + ( y 1 m x 1 ) means the point is below the segment.
If you already have the equation of the line joining the points as A x + B y + C = 0, then the equation of the line can be expressed as y = B A x C A , so just check to see whether q > B A p C A or not.

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get your answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?