View Full Version : How to determine CW or CCW?
05-17-2004, 07:57 AM
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?
05-17-2004, 11:36 AM
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.
05-17-2004, 12:28 PM
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.
05-17-2004, 04:30 PM
Here is a link :
The source provided only returns convexity, but if you add up the cross products, you will get the winding order.
05-17-2004, 08:41 PM
Thanks a lot!
My problem is completely solved :)
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.