   TriangleIsCCW() From Real Time Collision Detection
  I'm working my way through Real Time Collision Detection and I'm trying to write an algorithm to compute a convex hull.  Doing so, using the QuickHull algorithm, is reliant on pruning points inside the existing hull while it is being constructed.  In Section 5.4.1 of the book, Ericson gives a method for testing if a point resides in a convex polygon.  This method: PointInConvexPolygon() calls another method called TriangleIsCCW().Unfortunately, I cannot find the source code for this method (TraingleIsCCW()) in the book.  Does anyone know exactly how this method works, or would be kind enough to provide some source code?  Thank you.   
  You need a normal and 3 non colinear points for this to work:   /// <summary>   /// Determines whether the order of the specified vertices is counter-clockwise with respect to a normal.   /// </summary>   /// <param name="n">The triangle normal.</param>   /// <returns>Returns a value indicating whether the vertices are specified in counter-clockwise order.</returns>   public bool IsTriangleCCW(Vector3 n)   {  // > 0 for counterclockwise    // = 0 for none (degenerate)    // < 0 for clockwise  // Triangle vertices  Vector3 p0 = vertices[0].Position;   Vector3 p1 = vertices[1].Position;   Vector3 p2 = vertices[2].Position;  Vector3 c1 = new Vector3(p0.X - p1.X, p0.Y - p1.Y, p0.Z - p1.Z);  Vector3 c2 = new Vector3(p0.X - p2.X, p0.Y - p2.Y, p0.Z - p2.Z);  c1 = Vector3.Cross(c1, c2);  return Vector3.Dot(n, c1) > 0.0001f;  // Small epsilon value   }Hopefully the code should be self explanatory, it is written in C#.   