If none of the edges of a triangle and none of the vertices of this triangle sit on a straight line then this straight line has exactly two common points with the triangle if it has at least one common point with it.
Let your points be listed in an array. Let the points in the list denoted by $A_i$. Take the straight line determined by $A_1$ and $A_2$. If $A_k$ is the first point in the list that is on this straight line then you get the equation of a straight line belonging to an edge. If there is no such $A_k$ then the first two points in the list don't belong to one edge. If this is the case then take $A_1$ and $A_3$ an repeat the previous procedure. If there is no suitable $k$ then go on with $A_1$ and $A_4$. It is impossible that you go through the whole list and never find a suitable $A_k$ if we may assume that there are at least three points on each edge.
Having found the straight line belonging to one of the edges find the first point in the list that did not belong to the straight line already found. Place this point at the beginning of your list and start the whole procedure over again. You will find the equation belonging to another edge.
Repeat all this once again.
At the end you will have three straight lines whose intersection points will be the vertices of your triangle.