Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: How to determine CW or CCW?

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2004
    Location
    Taiwan
    Posts
    14

    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!

  2. #2
    Junior Member Regular Contributor
    Join Date
    Apr 2001
    Location
    U.S.
    Posts
    149

    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.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Apr 2001
    Location
    U.S.
    Posts
    149

    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.

  4. #4
    Junior Member Newbie
    Join Date
    May 2003
    Location
    USA
    Posts
    26

    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.

  5. #5
    Junior Member Newbie
    Join Date
    Apr 2004
    Location
    Taiwan
    Posts
    14

    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
  •