say, I have 100 points and want to draw a closedcurve (I’m using C# and graphics), like this:
Graphics g = this.CreateGraphics();
Pen pen = new Pen(Color.Black, 2);
Point[] points = new Point[DrawingPoints];
for (int x = 0; x < DrawingPoints; x++)
{
int px = r.Next(0, MaxXSize);
int py = r.Next(0, MaxYSize);
Point p = new Point(px, py);
points[x] = p;
}
g.DrawClosedCurve(pen, points);
It is connecting points as they get into points[] and lines cross – you will not get a solid figure with this.
Is there an algorithm that will help me toss the points to get a solid figure? Here’s a picture below (tried as hard as I could hehe) to help visualize what I’m asking for.

Well, in O(n log n) time, you could compute the centroid of the points and sort them in order of angle about that centroid, leaving a star-shaped polygon. That’s efficient but probably messes up the order of your points too much.
I think you’d be happier with the results of a 2-OPT method for TSP (description here). 2-OPT is worst-case exponential but polynomial-time in practice.