# Thread: How to sort polygon vertices anticlockwise

1. ## How to sort polygon vertices anticlockwise

Good afternoon,

I need an algorithm to sort the vertices of a polygon in an anticlockwise order. I know it's rather simple (everything is!) but I get confused every time I try to do it.

C code or pseudocode would be fine.

Thanks,
Duetti

2. Are you given just a random set of points that make up a polygon? If so there would be more than one way to form the polygon so I'm not sure "sorting them anti-clockwise" would work so easily. Is there more to the problem? Are your polygons limited to the convex case?

3. You don't sort them in anti-clockwise or clockwise. Create the object with the sort order in mind and then let your 3D art proggy do the rest.

4. >Are you given just a random set of points that make up a polygon?
Yes, a random set of points that has been entered by the user.

>Are your polygons limited to the convex case?
Yes they are.

If the vertices are sorted anticlockwise then I can easily "fill" the polygon. Right now I demand that the user inputs the vertices in a specific order (anticlockwise).

5. > You don't sort them in anti-clockwise or clockwise. Create the object with the sort order in mind and then let your 3D art proggy do the rest.

Are you some kind of a moron? The "3D art proggy" will be virtually useless if it can not reorder the vertices.

Programming is not about writing code that nobody undestands (let alone use in other projects) so that you can impress your friends. As for the code fragments that you posted on one of the threads that I started (about linear interpolation), they suck. Completely unstructured, variables spawning in different parts of the code.

Get a proper education on the subject and then try to educate others.

I've also read a couple of them tutorials published on this site....(sigh)...zero modularity, zero reusability, don't quit your days jobs.

Anyway, I've overcome my problems (clipping,shading,etc) so all of you net nerds can kiss my ass. :-)

Duetti

6. Good luck getting help talking to people like that.

7. Attention BMJ, he he he

I've done what I wanted to do, so there is no reason to ask for anyone's help nor will I ever attempt to ask for help on forum's like this since they seem to be occupied mainly by immature programmer-wannabes, net nerds that use irony to mask their inability to debate and showoffs.

I just like to say out loud what some of you don't want to admit.

Duetti

8. Debate? What debate? You asked a question, two people offered help. I don't care about your other threads, I was originally concerned with this one, the question at hand here. It is an act of kindness to want to help. Telling people to kiss your ass, asking if they're idiots, telling people their code sucks, and suggesting that you don't really need anyone's lowly help at all, tells me that you're the immature showoff. </thinking out loud>

9. Watch out, BMJ. He's an internet tough-guy. He might beat you up .

10. bump.flames.closed = true;

Popular pages Recent additions