View Full Version : How to determine CW or CCW?

Southp

05-17-2004, 07:57 AM

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?

Thanks!

brcain

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.

brcain

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.

lxnyce

05-17-2004, 04:30 PM

Here is a link :

http://astronomy.swin.edu.au/~pbourke/geometry/clockwise/index.html#clockwise

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

Southp

05-17-2004, 08:41 PM

Thanks a lot!

My problem is completely solved :)

Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.