From e9737e93f3575bd9f6391fb5bdbcb5e87fb8866f Mon Sep 17 00:00:00 2001 From: Luigi Malomo Date: Tue, 3 Mar 2020 19:08:55 +0100 Subject: [PATCH] added VV and VF ordered star parameter to choose the CW ordering of returned pos/vertices --- vcg/simplex/face/topology.h | 44 ++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/vcg/simplex/face/topology.h b/vcg/simplex/face/topology.h index 004067c8..d17ca0f6 100644 --- a/vcg/simplex/face/topology.h +++ b/vcg/simplex/face/topology.h @@ -1108,7 +1108,7 @@ void VFExtendedStarVF(typename FaceType::VertexType* vp, * */ template -void VVOrderedStarFF(Pos &startPos, +void VVOrderedStarFF(const Pos &startPos, std::vector &vertexVec) { vertexVec.clear(); @@ -1119,6 +1119,27 @@ void VVOrderedStarFF(Pos &startPos, 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 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 +void VVOrderedStarFF(const Pos &startPos, + std::vector &vertexVec, + const bool ccw) +{ + vertexVec.clear(); + vertexVec.reserve(16); + std::vector > posVec; + VFOrderedStarFF(startPos,posVec,ccw); + for(size_t i=0;i &startPos, } } +/*! + * \brief Compute the ordered set of faces adjacent to a given vertex using FF adiacency + * + * \param startPos a Pos 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 +void VFOrderedStarFF(const Pos &startPos, + std::vector > &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 *