Artificial intelligent assistant

How to tell if 3 connected points are connected clockwise or counter-clockwise? I have three points: p1(x1,y1) p2(x2,y2) and p3(x3,y3). I am connecting p1 to p2 to p3. how can I tell if the triangle was drawn clockwise or counter-clockwise? How can I generalize this for n points? (you pass through a point exactly once, and no lines can cross). Thanks all!

If the points
$(x_1\mid y_1); (x_2\mid y_2); (x_3\mid y_3)$
are in anticlockwise order, then
$\begin{vmatrix} x_1&y_1&1\\\ x_2&y_2&1\\\ x_3&y_3&1\\\ \end{vmatrix}\gt 0$ . If clockwise, then $\lt 0$ .

If in a line, then $=0$ .

As for your second question, select one of the points and call it $P_1$. For $n$ points, you will conduct the same test on $n-2$ triangles, as follows:

Triangle #1: $P_1,P_2,P_3$
Triangle #2: $P_1,P_3,P_4$
Triangle #3: $P_1,P_4,P_5$
.............................
Triangle #n-4: $P_1,P_{n-3},P_{n-2}$
Triangle #n-3: $P_1,P_{n-2},P_{n-1}$
Triangle #n-2: $P_1,P_{n-1},P_{n}$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 7c85ba01208883c08dd81cf3da8d0b62