C++ (Qt) auto print_tr = [&](const std::string& msg, size_t cnt)->void { size_t pnt_cnt = (cnt > mTriangle.size()) ? mTriangle.size() : cnt ; if(pnt_cnt) std::cout<<msg<<std::endl; for(auto idx = mTriangle.begin(); std::distance(mTriangle.begin(), idx) < pnt_cnt; ++idx) { std::cout<<"("<<(*idx)[0]<<"," <<(*idx)[1]<<"," <<(*idx)[2]<<")"; if( ((std::distance(mTriangle.begin(), idx)+1) % 3) == 0 ) std::cout<<std::endl; else std::cout<<"\t"; } std::cout<<std::endl; };
C++ (Qt)// mark deleted points with -1 for (i = 0; i < delIndex.size(); ++i) tmp[delIndex[i]] = -1;
C++ (Qt)std::vector<int> need_del_point = {2, 2, 12, 24, 37, 42, 55, 69, 75, 84, 93 };
C++ (Qt)typedef std::vector <int> TIntVec; // returns -1 if index is deleted, otherwise a new indexint RemapIndex( int index, const TIntVec & vec ){ TIntVec::const_iterator it = std::lower_bound(vec.begin(), vec.end(), index); if (it == vec.end()) return index - vec.size(); if (*it == index) return -1; return index - std::distance(vec.begin(), it);}