コード例 #1
0
ファイル: tri_strip.cpp プロジェクト: QuLogic/jot-lib
/**********************************************************************
 * TriStrip:
 **********************************************************************/
Bface*
TriStrip::backup_strip(Bface* f, Bvert*& a) 
{
   // we'd like to draw a triangle strip starting at the 
   // given triangle and proceeding "forward." but to get 
   // the most bang for the buck, we'll first "backup" over 
   // as many triangles as possible to find a starting place 
   // from which we can generate a longer strip.

   assert(!f->flag());

   mark_face(f);

   Bface* ret = f;
   Bvert* b   = f->next_vert_ccw(a);
   Bedge* e;

   int i = 0;
   while((e = f->edge_from_vert((i%2) ? b : a)) &&
         e->consistent_orientation()            &&
         e->is_crossable()                      &&
         (f = e->other_face(f))                 &&
         is_cleared(f)) {
      mark_face(f);
      ret = f;
      Bvert* d = f->other_vertex(a,b);
      b = a;
      a = d;
      i++;
   }

   _orientation = ((i%2) != 0);

   return ret;
}