Given 3 points ((x1, y1), (x2, y2), (x3, y3)), how can I find if the point (a, b) is between all of these points?

873 Views Asked by At

Given 3 points $((x_1, y_1), (x_2, y_2), (x_3, y_3))$, how can I find if the point $(a, b)$ is between all of these points? In addition, how might one go about writing an equation to graph the area between these three points as a triangle?

2

There are 2 best solutions below

0
On

For the first question:

Find the vectors connecting the point to each of the triangle's three vertices and sum the angles between those vectors. If the sum of the angles is $2*\pi$ then the point is inside the triangle.

For the second question:

Not sure what you want. See the following link:

Finding out the area of a triangle if the coordinates of the three vertices are given

0
On

Let $\,z = a + ib\,$, and let $\,z_1,z_2,z_3\,$ be the vertices of the triangle in the complex plane.

For the first question, $\,z\,$ is inside the triangle iff the triplets $\,z,z_1,z_2\,$, $\,z,z_2,z_3\,$, $\,z,z_3,z_1\,$ have the same orientation. That can be checked by comparing the signs of the oriented area of each triangle.

For the second question, $\big\{\, \lambda_1 z_1 + \lambda_2z_2+\lambda_3z_3 \;\big|\; \lambda_{1,2,3} \in (0,1), \;\lambda_1+\lambda_2+\lambda_3=1\,\big\}\,$ is the parametric representation of the interior of the triangle $\,z_1z_2z_3\,$, as a particular case of the general convex combinations for $\,n=3\,$.