Ask Your Question

Revision history [back]

void getNeigs(const int vtx_idx, std::vector<cv::Point2f>& neigs) const{
    neigs.clear();
    if((vtx_idx < 4) || (vtx_idx >= vtx.size())){
        return;
    }
    const Vertex& vertex = vtx.at(vtx_idx);
    if(vertex.isfree() || vertex.isvirtual()){
        return;
    }
    const int first_edge = vertex.firstEdge;
    const int right_edge = getEdge(first_edge, NEXT_AROUND_RIGHT);
    int edge = right_edge;
    const size_t MAX_ITERATION = vtx.size();
    for(size_t iteration=0; iteration!=MAX_ITERATION; ++iteration){
        const int neig = edgeOrg(edge);
        neigs.emplace_back(vtx.at(neig).pt);
        edge = getEdge(edge, NEXT_AROUND_DST);
        if(edge == right_edge){
            return;
        }
    }
}