-
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?
Thanks!
-
Junior Member
Regular Contributor
Re: How to determine 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.
-
Junior Member
Regular Contributor
Re: How to determine CW or CCW?
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.
-
Re: How to determine CW or CCW?
Here is a link :
http://astronomy.swin.edu.au/~pbourk...html#clockwise
The source provided only returns convexity, but if you add up the cross products, you will get the winding order.
-
Re: How to determine CW or CCW?
Thanks a lot!
My problem is completely solved
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules