<!DOCTYPE html>
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Class - I have had multiple requests for office meetings and have
      been doing my best to respond to issues on Anvil in a timely
      manner.  Since your project is coming due I would like to
      designate tomorrow as a work day to accommodate those who could
      not come to my office hours.  </p>
    <p>As you continue to develop your code for the second project I
      want to offer a few "hints"...</p>
    <ol>
      <li>Don't be afraid of making global variables to hold the state
        of your program.  For example, in my code that draws the
        triangles I have to decide if they are to filled or if I am
        going to just draw the triagles.  So I have code line this...</li>
    </ol>
    <pre>
    if ( FILL ) { 
          for (i=1; i<numTriangles+1; i++ ){  

            glBegin(GL_POLYGON);
                glVertex2f( TRIANGLE_TYPE_2D_findNodeN(triangles,i)->triangle.vertex1.x,
                            TRIANGLE_TYPE_2D_findNodeN(triangles,i)->triangle.vertex1.y );
                glVertex2f( TRIANGLE_TYPE_2D_findNodeN(triangles,i)->triangle.vertex2.x,
                            TRIANGLE_TYPE_2D_findNodeN(triangles,i)->triangle.vertex2.y );
                glVertex2f( TRIANGLE_TYPE_2D_findNodeN(triangles,i)->triangle.vertex3.x,
                            TRIANGLE_TYPE_2D_findNodeN(triangles,i)->triangle.vertex3.y );
            glEnd();
        }
    }
        else {
            for (i=1; i<numTriangles+1; i++ ){  
                glBegin(GL_LINE_LOOP);
                glVertex2f( TRIANGLE_TYPE_2D_findNodeN(triangles,i)->triangle.vertex1.x,
                            TRIANGLE_TYPE_2D_findNodeN(triangles,i)->triangle.vertex1.y );
                glVertex2f( TRIANGLE_TYPE_2D_findNodeN(triangles,i)->triangle.vertex2.x,
                            TRIANGLE_TYPE_2D_findNodeN(triangles,i)->triangle.vertex2.y );
                glVertex2f( TRIANGLE_TYPE_2D_findNodeN(triangles,i)->triangle.vertex3.x,
                            TRIANGLE_TYPE_2D_findNodeN(triangles,i)->triangle.vertex3.y );
                glEnd();
            }
        }
 }


</pre>
    <ol start="2">
      <li>Let your keyboard and mouse functions set the state of the
        global variables.</li>
      <li>Feel free to use multiple arrays to help you build out your
        tree.  I have one for the full circle, one for the canopy, and
        then one for the tree.</li>
      <li>When you call the clipping algorithm (Southerland Hodgman) you
        generally have to call it multiple times in succession with
        different clip edges.  For example, in the following code I am
        clipping against the four edges of a rectangle.  I call the same
        function, but I pass it in the clipped array of points from the
        previous call and then swap on the next call.</li>
    </ol>
    <pre><span>    edge[0].x=VIEWPORT_MIN; edge[0].y=VIEWPORT_MAX;
    edge[1].x=VIEWPORT_MIN; edge[1].y=VIEWPORT_MIN;</span>
<span>    SutherlandHodgmanPolygonClip(inVertex,outVertex,*inlength,outlength,eptr);

    edge[0].x=VIEWPORT_MIN; edge[0].y=VIEWPORT_MIN;
    edge[1].x=VIEWPORT_MAX; edge[1].y=VIEWPORT_MIN;
    SutherlandHodgmanPolygonClip(outVertex,inVertex,*outlength,inlength,eptr);

    edge[0].x=VIEWPORT_MAX; edge[0].y=VIEWPORT_MIN;
    edge[1].x=VIEWPORT_MAX; edge[1].y=VIEWPORT_MAX;
    SutherlandHodgmanPolygonClip(inVertex,outVertex,*inlength,outlength,eptr);

    edge[0].x=VIEWPORT_MAX; edge[0].y=VIEWPORT_MAX;
    edge[1].x=VIEWPORT_MIN; edge[1].y=VIEWPORT_MAX;
    SutherlandHodgmanPolygonClip(outVertex,inVertex,*outlength,inlength,eptr);

</span></pre>
    <ol start="4">
      <li>TRANSFORM BEFORE YOU CLIP</li>
      <li>CLIP BEFORE YOU TESSELATE</li>
      <li>I would like you code somewhat segmented into separate files.</li>
      <li>I need to be able simply type "make" to build your code.</li>
      <li>I am not worried too much about performance speed -- but if it
        is excessive (like you tree never moves once it is tesselated) I
        will have to take that into account.  Point here is that you
        need to focus more on functinality than trying to make it fast.</li>
    </ol>
    <p>I'll be in the lab tomorrow morning if anyone wants to come meet
      with me.</p>
    <p><br>
    </p>
    <div class="moz-signature">-- <br>
      <b>Andrew J. Pounds, Ph.D.</b><br>
      <i>Professor of Chemistry and Computer Science</i><br>
      <i>Director of the Computational Science Program</i><br>
      <i>Mercer University, Macon, GA, 31207 (478) 301-5627 </i></div>
  </body>
</html>