Example #1
0
void KantShelling::SetAdjFaces()  
/* set Brin2Face, Face2Brin, IsOuterV, IsOuterE.
       b = Face2Brin[num]
       b and acir[b] defines an angle
       Moving along a face: cir[-b] or -acir[b]
    */
  {tbrin b, b0;
  // Mark the vertices incident to the last face
  Prop<short> ecolor(G.Set(tedge()),PROP_COLOR);
  Prop<int> ewidth(G.Set(tedge()),PROP_WIDTH);
  b = b0 = FirstBrin();
  do
      {BelongToLastFace[G.vin[b]()] = 1;
      if(debug()) {ecolor[b.GetEdge()] = Green2;ewidth[b.GetEdge()] = 3;}
      }while((b = -G.cir[b]) != b0);

  IntList Brins;  // Brins: list of all brins 
  for(int i = -G.ne();i <= G.ne();i++)
      if(i)Brins.push(i);
  // the edge {v_1,v_2}. IsOuterE is set to 0.
  Brin2Face[FirstBrin()]=1;			  
  IsOuterV[v_1] = 1;
  Brins.del(FirstBrin());

  // the outer face is indexed 1
  b = G.cir[-FirstBrin];
  do 
      {Brins.del(b());
      Brin2Face[b()] = 1;
      IsOuterE[b.GetEdge()] = 1;
      IsOuterV[G.vin[b]()] = 1;
      }while ((b = G.cir[-b])  != FirstBrin);
  Face2Brin[1]=FirstBrin();

  // indexing other faces.
  int FaceIndex=2;
  while (!Brins.empty()) 
      {b0 = b =Brins.first();
       if(debug())cout << "face:" << FaceIndex << endl;
      do 
          {Brins.del(b());
          Brin2Face[b]=FaceIndex;
           if(debug())cout << G.vin[b]() << " " <<endl;
          } 
      while((b = G.cir[-b]) != b0);

      Face2Brin[FaceIndex]=b();
      FaceIndex++;
      }
  }
Example #2
0
static bool compare(const IntList& flist, const std::list<int>& l)
{
    if (flist.size() == l.size())
    {
        IntList::ConstElementHandler h(flist.first());
        std::list<int>::const_iterator it = l.begin();

        bool equals = true;
        while (h.is_valid() && equals)
        {
            equals = *h == *it;
            ++h;
            ++it;
        }
        return equals;
    }
    else
    {
        return false;
    }
}