int TriangleAdjacencyGraph::calcEgdeLines ( vector<Index> & indexVec, bool codeBorder )
{
  unsigned int i, nN, j, nE, halfEdgeCount = 0;
  Index startVertexIndex, endVertexIndex;
  HalfEdge *halfEdge;
  bool isBorder;

  indexVec.clear();
  nN = _temporaryVector.size();
  for (i = 0; i < nN; i++) {
    nE = _temporaryVector[i].size();
    for ( j = 0; j < nE; j++) {      
      halfEdge = _temporaryVector[i][j].second;
      startVertexIndex = halfEdge->vertexStart();
      endVertexIndex = halfEdge->vertexEnd();

      if ((isBorder = (halfEdge->twin == 0)) || (startVertexIndex <
	    endVertexIndex)) {
	indexVec.push_back(startVertexIndex);
	indexVec.push_back(endVertexIndex);
	if (codeBorder)
	  indexVec.push_back(isBorder ? 0 : 1);
	halfEdgeCount++;
      }
    }
  }

  return halfEdgeCount;
}
Example #2
0
//----------------------------------------------------------------------
// Method: calcEdgeLines
// Author: jbehr
// Date:   Tue Feb 15 18:16:59 2000
// Description:
//
//----------------------------------------------------------------------
Int32 HalfEdgeGraph::calcEgdeLines(vector<HalfEdgeGraph::IndexT> & indexVec,
                                   bool codeBorder )
{
    UInt32 i, nN, j, nE, halfEdgeCount = 0;
    HalfEdgeGraph::IndexT startVertexIndex, endVertexIndex;
    HalfEdge *halfEdge;
    bool isBorder;

    indexVec.clear();
    nN = _edgeLinkVec.size();
    for (i = 0; i < nN; ++i)
    {
        nE = _edgeLinkVec[i].size();
        for ( j = 0; j < nE; ++j)
        {
            halfEdge = _edgeLinkVec[i][j].second;
            startVertexIndex = halfEdge->vertexStart();
            endVertexIndex = halfEdge->vertexEnd();

            if ((isBorder = (halfEdge->twin == 0)) || (startVertexIndex <
                    endVertexIndex))
            {
                indexVec.push_back(startVertexIndex);
                indexVec.push_back(endVertexIndex);
                if(codeBorder)
                    indexVec.push_back(isBorder ? 0 : 1);
                ++halfEdgeCount;
            }
        }
    }
    return halfEdgeCount;
}
int TriangleAdjacencyGraph::fillIndexFromFan( std::vector<Index> &indexVec,
    HalfEdge &firstEdge )
{
  int count = 0;
  HalfEdge *halfEdge(&firstEdge);
  HalfEdge *gateEdge = 0;

  if (halfEdge) {
    count = 3;
    indexVec.resize(2);
    indexVec[0] = halfEdge->vertexStart();
    indexVec[1] = halfEdge->vertexEnd();
    for ( gateEdge = halfEdge->next->next->twin;
	gateEdge != halfEdge;
	gateEdge = gateEdge->next->next->twin ) {
      indexVec.push_back(gateEdge->vertexEnd());
      count++;
    }
    indexVec.push_back(halfEdge->vertexEnd());
  }
  else {
    cerr << "Invalid fac in fillIndexFromFan()" << endl;
  }

  return count;
}
Example #4
0
//----------------------------------------------------------------------
// Method: fillPrimFromFan
// Author: jbehr
// Date:   Tue Feb 15 18:16:59 2000
// Description:
//
//----------------------------------------------------------------------
Int32 HalfEdgeGraph::fillIndexFromFan(std::vector<HalfEdgeGraph::IndexT> &indexVec,
                                      HalfEdge &firstEdge )
{
    Int32 count = 0;
    HalfEdge *halfEdge(&firstEdge);
    HalfEdge *gateEdge = 0;

    if(halfEdge)
    {
        count = 3;
        indexVec.resize(2);
        indexVec[0] = halfEdge->vertexStart();
        indexVec[1] = halfEdge->vertexEnd();
        for(gateEdge = halfEdge->next->next->twin;
                gateEdge != halfEdge;
                gateEdge = gateEdge->next->next->twin)
        {
            indexVec.push_back(gateEdge->vertexEnd());
            ++count;
        }
        indexVec.push_back(halfEdge->vertexEnd());
    }
    else
    {
        SWARNING << "Invalid fac in fillIndexFromFan()" << endl;
    }
    return count;
}