TOPICS
Search

Triangle Interior


TriangleInterior

The interior of the triangle is the set of all points inside a triangle, i.e., the set of all points in the convex hull of the triangle's vertices.

The simplest way to determine if a point lies inside a triangle is to check the number of points in the convex hull of the vertices of the triangle adjoined with the point in question. If the hull has three points, the point lies in the triangle's interior; if it is four, it lies outside the triangle.

To determine if a given point v lies in the interior of a given triangle, consider an individual vertex, denoted v_0, and let v_1 and v_2 be the vectors from v_0 to the other two vertices. Expressing the vector from v_0 to v in terms of v_1 and v_2 then gives

 v=v_0+av_1+bv_2,
(1)

where a and b are constants. Solving for a and b gives

a=(det(v v_2)-det(v_0 v_2))/(det(v_1 v_2))
(2)
b=-(det(v v_1)-det(v_0 v_1))/(det(v_1 v_2)),
(3)

where

 det(u v)=uxv=u_xv_y-u_yv_x
(4)

is the determinant of the matrix formed from the column vectors u and v. Then the point v lies in the interior of the triangle if a,b>0 and a+b<1.

If the convex hull of the triangle vertices plus the point v_0 is bounded by four points, the point v_0 lies outside the triangle. However, if it contains three points, the point v_0 may lie either in the interior or in the exterior.


See also

Convex Hull, Triangle, Triangle Point Picking

Explore with Wolfram|Alpha

Cite this as:

Weisstein, Eric W. "Triangle Interior." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/TriangleInterior.html

Subject classifications