Order of points in space

Return A List of Points From Intersect That Create a Clockwise Polygon

After doing some research, I found out that this guy did it. I haven’t completely understood the solution, I have copied and pasted it into my own workspace and it gave the exact solution that I wanted. (I hate myself)