Point inside a Triangle
Date: 07/15/2001 at 14:53:58 From: Dingo Bob Subject: Checking to see if a point is inside a triangle If you have any four points, and three of them are the corners of a triangle, is there a formula to determine whether or not the fourth is inside the triangle? If not, what's the best way to check? The three corners can be anywhere (positive or negative) and the triangle is not necessarily (but can be) anything special (isoceles, equilateral, etc.). Thank you for reading my question.
Date: 07/17/2001 at 17:26:20 From: Doctor Jaffee Subject: Re: Checking to see if a point is inside a triangle Hi Dingo Bob, The easiest way to determine whether a point is inside a triangle is to plot the points on a grid, connect the vertices of the triangle, and look and see. However, if I understand your question correctly, you are looking for a strictly algebraic method for solving the problem. Here is how I would do it. First, I would pick any two of the vertices and determine the equation of the line that contains them. For example, suppose the three vertices are at A(-2,3), B(5,1) and C(-6,-4). The equation of the line that connects A and B is y = (-2/7)x + 17/7. If you substitute the cooordinates of point C into the equation, you get -4 = (-2/7)(-6) + 17/7, or -4 = 29/7, but -4 is much smaller than 29/7, so we can conclude that C is below the line that connects A and B. That means that the fourth point (let's call it D) must be below the line that connects A and B. Next, find the equation of the line containing B and C. You will see that A is above that line, so D must be above the line. Finally, find the equation of the line containing A and C. You will find that B is below that line, so D must be below the line. If D satisfies all three conditions (below the two lines and above the other), then D is inside the triangle; otherwise it isn't. I hope my answer has helped you understand the problem better. I have assumed that you understand how to find the equation of a line, given two points on the line. If you don't, check the archives for help or write back. You might also want to read a more general answer from our archives: Formula for Point in Rectangle http://mathforum.org/dr.math/problems/scott5.31.96.html Thanks for writing to Ask Dr. Math. - Doctor Jaffee, The Math Forum http://mathforum.org/dr.math/
Search the Dr. Math Library:
Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.