Archived

This topic is now archived and is closed to further replies.

Polygon vertex order

This topic is 6363 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I''m a newbie in the 3d field and I seethat for lighting your polygon has to haveits vertices aligned in clockwise order. Does this mean the 2d projection points have to be in 2d order? And how exactly would I go about doing this, any well known methods? ------------------------------ fclose(fp) ------------------------------

Share this post


Link to post
Share on other sites
You have right hand systems and left hand systems. Normals are derived from crossing two vectors defining edges of a polygon.

I have written 4 cross functions:
crosscwrhs
crossccwrhs
crosscwlhs
crossccwlhs

Actually, I wrote only one cross function, and #defined 3 others which reverse the input order if necessary.

Each of these functions will return a vector normal to the plane defined by the two input vectors. The normal returned will be facing you if you are using the cross function that is consistent with the cooridnate system and the conssistent with the winding of the vectors. If you reverse the order of the input vectors, you have changed their winding from clockwise to counter-clockwise or the opposite.

If you are in 3d space and outside an object and want a normal facing you, then you have to calculate the cross correctly. This is dependent on the winding of the input vectors, and whether you are using a right hand or left hand cooridnate system.

Winding (cw or ccw) is only consistent for all edges of a polygon if it is convex. If it is concave, further processing is required.



Share this post


Link to post
Share on other sites