Actually it is an algorithm problem, however I cannot solve the problem. So, We have 4 points, how can we know what kind of shape(figure) can be drawn ? I want to learn mathematically. If possible i wonder formulas with four points. There are some examples
1.0 1.0
2.0 1.0
3.0 1.0
5.5 5.0
Your points can construct:
A triangle
1.0 1.0
2.0 1.0
3.0 1.0
5.5 1.0
Your points can construct:
A line
1.0 1.0
2.0 1.0
3.0 6.0
5.5 5.0
Your points can construct:
A quadrilateral
If you have $4$ points $(x_1,y_1), \ldots, (x_4,y_4)$, then there are $3$ possible answers:
To check if some $3$ points $(x_1,y_1), ~ (x_2,y_2), ~ (x_3,y_3)$ are on one line (are collinear), one can build this value:
$$ C_{123} = \left|\begin{array}{ccc} x_1 & y_1 & 1 \\ x_2 & y_2 & 1 \\ x_3 & y_3 & 1 \\ \end{array}\right| \tag{1} $$
and apply test: if $C_{123}=0$, then points are collinear, if $C_{123}\ne 0$, then no.
This way you'll need to check $4$ values: $C_{123}$, $C_{124}$, $C_{134}$, $C_{234}$.
Sometimes your calculations can be terminated earlier:
if you'll find one zero and one (or more) non-zero values, then it is triangle;
if you'll find two zero values, then it is line (other values must be zero too).
Expression in $(1)$ is determinant, and here is formula for it:
$$ C_{123} = ... = x_1y_2 + x_2y_3+x_3y_1 - x_1y_3-x_2y_1-x_3y_2 \\ = x_1(y_2-y_3) + x_2(y_3-y_1)+x_3(y_1-y_2). $$