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!
Guy Hengel [angelIII / a3]Billing EngineerCommented:
well, this is actually a basically math (geometry) problem.
once, you know the solution on math level, just translate it to the programming language you use.
btw: which programming language DO you use?
so, 1 point, either yes or no if it is on one of the 3 lines?
divide an conquer: you have to check, for the 3 lines between the 3 possible pairs of 2 points each time, if the point is on that line.
say, the 2 points are A and B, and the point to check is C
to know if a point is on a segment, 2 checks:
check 1: what is the Angle between AB and AC? if 0 -> then C is on the half-segment [AB)
check 2: what is the distance AB compared to the distance A? if 0 <= AC <= AB -> then C is closer to A than B
if both checks are true, then C is on the segment AB, hence on the line between A and B
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.
0
Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.
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
once, you know the solution on math level, just translate it to the programming language you use.
btw: which programming language DO you use?
so, 1 point, either yes or no if it is on one of the 3 lines?
divide an conquer: you have to check, for the 3 lines between the 3 possible pairs of 2 points each time, if the point is on that line.
say, the 2 points are A and B, and the point to check is C
to know if a point is on a segment, 2 checks:
check 1: what is the Angle between AB and AC? if 0 -> then C is on the half-segment [AB)
check 2: what is the distance AB compared to the distance A? if 0 <= AC <= AB -> then C is closer to A than B
if both checks are true, then C is on the segment AB, hence on the line between A and B