Finding all coordinates of a triangle on a graph using three vertices.

200 Views Asked by At

I'm working on computer program and I need to know how to find all of the coordinates (x, y) of a triangle given on a graph using the three vertices. The Triangle may be any type including right, equilateral, obtuse, acute, etc.. Is there any way to find all of these coordinates? Please help.

1

There are 1 best solutions below

0
On BEST ANSWER

Let your vertices be $(x_1,y_1)$, $(x_2,y_2)$ and $(x_3,y_3)$

If you only wants the borders, your triangle is : $$\bigcup\limits_{i \ne j, (i,j)\in[1,3]^2}\{(tx_i+(1-t)x_j,ty_i+(1-t)y_j), t \in [0,1])\}$$

else it is : $$\{(\alpha x_1 + \beta x_2 + \gamma x_3,\alpha y_1 + \beta y_2 + \gamma y_3), (\alpha, \beta, \gamma) \in [0,1]^3, \alpha+\beta+\gamma=1\}$$