title: How to draw a tapered arc (curve with decreasing thickness) in OpenGL?
body: <p>I have the following code to draw an arbitrary arc:</p>
  
  <pre><code>void CenteredArc::drawPolygonArc(float radius, float thickness, float startAngle, float arcAngle) {
      float num_segments = 360.0;
  
      float radiusOuter = radius + thickness / 2;
      float radiusInner = radius - thickness / 2;
      float theta = arcAngle / num_segments; 
      float tangetial_factor = tanf(theta);//calculate the tangential factor 
  
      float radial_factor = cosf(theta);//calculate the radial factor 
  
      float xxOuter = radiusOuter * cosf(startAngle);
      float yyOuter = radiusOuter * sinf(startAngle);
      float xxInner = radiusInner * cosf(startAngle);
      float yyInner = radiusInner * sinf(startAngle);  
  
      float prevXXOuter = -1;
      float prevYYOuter = -1;
      float prevXXInner = -1;
      float prevYYInner = -1;
  
      glPolygonMode(GL_FRONT, GL_FILL);
      for(int ii = 0; ii &lt; num_segments; ii++) 
      { 
          if (prevXXOuter != -1) {
              glBegin(GL_POLYGON);
                  glVertex2f(prevXXOuter, prevYYOuter);
                  glVertex2f(xxOuter,     yyOuter);
                  glVertex2f(xxInner,     yyInner);
                  glVertex2f(prevXXInner, prevYYInner);
              glEnd();
          }
  
          //calculate the tangential vector 
          //remember, the radial vector is (x, y) 
          //to get the tangential vector we flip those coordinates and negate one of them 
  
          float txOuter = -yyOuter; 
          float tyOuter =  xxOuter; 
          float txInner = -yyInner; 
          float tyInner =  xxInner; 
  
          //add the tangential vector 
  
          prevXXOuter = xxOuter;
          prevYYOuter = yyOuter;
          prevXXInner = xxInner;
          prevYYInner = yyInner;
  
          xxOuter += txOuter * tangetial_factor; 
          yyOuter += tyOuter * tangetial_factor; 
          xxInner += txInner * tangetial_factor; 
          yyInner += tyInner * tangetial_factor; 
  
          //correct using the radial factor 
          xxOuter *= radial_factor; 
          yyOuter *= radial_factor; 
          xxInner *= radial_factor; 
          yyInner *= radial_factor; 
      }
  }
  </code></pre>
  
  <p>However, I would like for the arc to start off with the specified thickness on one end and gradually decrease to a thickness of zero on the other end.  Any suggestions?</p>
  
  <p>Edit: I am not using <code>GL_LINE_STRIP</code> because I am trying to avoid having overlapping lines and gaps like so:</p>
  
  <p><img src="https://i.stack.imgur.com/rh2rq.png" alt="enter image description here"></p>