I have two points and 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 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 or What am I doing wrong? Do I need to use a different form of the linear equation?
Answer & Explanation
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:
Then given any , you can test directly whether the point lies above or below the point on the line that has the same coordinate.
delirija7z
Expert
2022-07-12Added 5 answers
Suppose your given points are and . First get the slope . The equation of the line joining the points is , where you just substitute , and . In slope intercept form the equation is
Given a point , first check that . Then: means the point is above the segment, and means the point is below the segment. If you already have the equation of the line joining the points as , then the equation of the line can be expressed as , so just check to see whether or not.