title: Fastest way of converting a quad to a triangle strip?
body: <p>What is the fastest way of converting a quadrilateral (made up of four <code>x,y</code> points) to a triangle strip? I'm well aware of the general triangulation algorithms that exist, but I need a short, <strong>well optimized</strong> algorithm that deals with quadrilaterals only.</p>
  
  <p>My current algorithm does this, which works for <strong>most</strong> quads but still gets the points mixed up for some:</p>
  
  <pre><code>#define fp(f) bounds.p##f
  
  /* Sort four points in ascending order by their Y values */
  point_sort4_y(&amp;fp(1), &amp;fp(2), &amp;fp(3), &amp;fp(4));
  
  /* Bottom two */
  if (fminf(-fp(1).x, -fp(2).x) == -fp(2).x)
  {
      out_quad.p1 = fp(2);
      out_quad.p2 = fp(1);
  }
  else
  {
      out_quad.p1 = fp(1);
      out_quad.p2 = fp(2);
  }
  
  /* Top two */
  if (fminf(-fp(3).x, -fp(4).x) == -fp(3).x)
  {
      out_quad.p3 = fp(3);
      out_quad.p4 = fp(4);
  }
  else
  {
      out_quad.p3 = fp(4);
      out_quad.p4 = fp(3);
  }
  </code></pre>
  
  <p><strong>Edit:</strong> I'm asking about converting a <strong>single</strong> quad to a single triangle strip that should consist of four points.</p>