Link to home
Start Free TrialLog in
Avatar of Cervan
CervanFlag for Hong Kong

asked on

Does a point lie on the triangle?

It is given that there are four points where three points are used to form a traingle.How can I know the forth point whether it lies on the triangle(not inside or outside the triangle)?Can someone help me with this little problem?Thank you!
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Cervan

ASKER

actually I can find whether the point lies inside or outside the triangle,but I cannot test the forth point if it lies on the boundary of the triangle.(I am using C program)Also,I am not given the angle.
the point is on the triangle if it is on one of the line segments.
using the point in polygon test mentioned above, instead of a sign change, you would get 0
To test if a point lies exactly on a line
http://mathworld.wolfram.com/Collinear.html
To lie on a line segment it would also have to be between the end points.