How to determine CW or CCW?

As title.
Given an ordered list of vertices of a simple polygon.If we know that it’s either CW or CCW,then how to determine it’s CW or CCW?


Assuming your speaking in 3D context … CCW vs CW depends upon viewpoint. Compute the normal of the facet using three non-coincident vertices. Normal emanates out of front face.

For 2D could still use the same concept.

Could just add third dimension to points with z=0. Compute the normal. Then, is CCW if z-component of normal > 0. Otherwise is CW.

Or, more efficiently, just compute the z-component of the normal only – ignoring the magnitude and avoiding the sqrt() calculation.

Here is a link :

The source provided only returns convexity, but if you add up the cross products, you will get the winding order.

Thanks a lot!
My problem is completely solved :slight_smile: