Use HDK to implement vex neighbours ()

   1127   0   1
User Avatar
Member
15 posts
Joined: 2月 2011
Offline
First of all, I used the GU_Detail::buildRingZeroPoints() function to find neighbors. This function has very good performance. Then I want to find the neighbor point of the neighbor, this function cannot do it.

So I used GEO_HedgeInterface to achieve it, but the performance is very low.
this code same as GU_Detail::buildRingZeroPoints():
std::vector<GA_Offset> neighbours(GU_Detail* gdp, GEO_HedgeInterface& halfEdgeIfer, const GA_Offset &ptnum)
{

    // build a list
    std::vector <GA_Offset> nbs;
    //
    GEO_Hedge iterEdge = halfEdgeIfer.firstIncidentEdge(ptnum);
    GEO_Hedge endEdge = iterEdge;
    while(1){
        auto srcptoff = halfEdgeIfer.srcPoint(iterEdge);
        auto endptoff = halfEdgeIfer.dstPoint(iterEdge);
        std::vector<GA_Offset>::iterator srcpt_find = std::find(nbs.begin(), nbs.end(), srcptoff);
        std::vector<GA_Offset>::iterator endpt_find = std::find(nbs.begin(), nbs.end(), endptoff);
        if (srcptoff != ptnum && (srcpt_find == nbs.end())) {
            nbs.emplace_back(srcptoff);
        }
        if (endptoff != ptnum && (endpt_find == nbs.end())) {
            nbs.emplace_back(endptoff);
        }
        iterEdge = halfEdgeIfer.nextIncidentEdge(iterEdge, ptnum);
        if (iterEdge == endEdge) 
            break;
    }
    return std::move(nbs);
}

How to achieve higher performance in this way? In other words, there are other methods that have the same performance as GU_Detail::buildRingZeroPoints()

thanks
Edited by liuping207 - 2021年3月4日 11:06:40
  • Quick Links