added VV and VF ordered star parameter to choose the CW ordering of returned pos/vertices

This commit is contained in:
Luigi Malomo 2020-03-03 19:08:55 +01:00
parent 62a9ed2fd1
commit e9737e93f3
1 changed files with 43 additions and 1 deletions

View File

@ -1108,7 +1108,7 @@ void VFExtendedStarVF(typename FaceType::VertexType* vp,
* *
*/ */
template <class FaceType> template <class FaceType>
void VVOrderedStarFF(Pos<FaceType> &startPos, void VVOrderedStarFF(const Pos<FaceType> &startPos,
std::vector<typename FaceType::VertexType *> &vertexVec) std::vector<typename FaceType::VertexType *> &vertexVec)
{ {
vertexVec.clear(); vertexVec.clear();
@ -1119,6 +1119,27 @@ void VVOrderedStarFF(Pos<FaceType> &startPos,
vertexVec.push_back(posVec[i].VFlip()); vertexVec.push_back(posVec[i].VFlip());
} }
/*!
* \brief Compute the ordered set of vertices adjacent to a given vertex using FF adiacency
*
* \param startPos a Pos<FaceType> indicating the vertex whose star has to be computed.
* \param vertexVec a std::vector of VertexPtr filled vertices around the given vertex.
* \param ccw if true returns the vertexVec in countercounterclockwise order; if false in clockwise order.
*
*/
template <class FaceType>
void VVOrderedStarFF(const Pos<FaceType> &startPos,
std::vector<typename FaceType::VertexType *> &vertexVec,
const bool ccw)
{
vertexVec.clear();
vertexVec.reserve(16);
std::vector<Pos<FaceType> > posVec;
VFOrderedStarFF(startPos,posVec,ccw);
for(size_t i=0;i<posVec.size();++i)
vertexVec.push_back(posVec[i].VFlip());
}
/*! /*!
* \brief Compute the ordered set of faces adjacent to a given vertex using FF adiacency * \brief Compute the ordered set of faces adjacent to a given vertex using FF adiacency
* *
@ -1158,6 +1179,27 @@ void VFOrderedStarFF(const Pos<FaceType> &startPos,
} }
} }
/*!
* \brief Compute the ordered set of faces adjacent to a given vertex using FF adiacency
*
* \param startPos a Pos<FaceType> indicating the vertex whose star has to be computed.
* \param posVec a std::vector of Pos filled with Pos arranged around the passed vertex.
* \param ccw if true returns the posVec in countercounterclockwise order; if false in clockwise order.
*
*/
template <class FaceType>
void VFOrderedStarFF(const Pos<FaceType> &startPos,
std::vector<Pos<FaceType> > &posVec,
const bool ccw)
{
VFOrderedStarFF(startPos, posVec);
const auto & pos = posVec[0];
if (ccw != (pos.VFlip() == pos.F()->V(pos.F()->Prev(pos.VInd()))))
{
std::reverse(posVec.begin(), posVec.end());
}
}
/*! /*!
* \brief Compute the ordered set of faces adjacent to a given vertex using FF adiacency * \brief Compute the ordered set of faces adjacent to a given vertex using FF adiacency
* *