How to check if VERTEX ARRAY is clockwise?
<p><strong>Solved</strong>, used this code:</p>

<pre><code>if ( !isClockwise(TempVectArray) ) { Collections.reverse(TempVectArray); }
</code></pre>

<p>...</p>

<pre><code>private boolean isClockwise(ArrayList&lt;Vec2&gt; arl){
    Iterator&lt;Vec2&gt; it = arl.iterator();
    Vec2 pt1 = (Vec2)it.next();
    Vec2 firstPt = pt1;
    Vec2 lastPt = null;
    double area = 0.0;
    while(it.hasNext()){
        Vec2 pt2 = (Vec2) it.next();
        area += (((pt2.x - pt1.x) * (pt2.y + pt1.y)) / 2);
        pt1 = pt2;
        lastPt = pt1;
    }
    area += (((firstPt.x - lastPt.x) * (firstPt.y + lastPt.y)) / 2);
    return area &lt; 0;
}
</code></pre>

<hr>

<p>Suppose I get a vertex array from the user tapping on the screen, but need it to be clockwise.</p>

<p>Maybe you know of some standard methods to check if it is clockwise and if it's not, then make it clockwise?</p>

<p><img src="http://i.stack.imgur.com/IvBaU.png" alt="enter image description here"></p>

<p>Thanks!</p>
