void THierarchicalCluster::permute(const TIntList &neworder) { if ((!branches && neworder.size()) || (branches->size() != neworder.size())) raiseError("the number of clusters does not match the lenght of the permutation vector"); int *temp = new int [last - first], *t = temp; TIntList::const_iterator pi = neworder.begin(); THierarchicalClusterList::iterator bi(branches->begin()), be(branches->end()); THierarchicalClusterList newBranches; for(; bi != be; bi++, pi++) { PHierarchicalCluster branch = branches->at(*pi); newBranches.push_back(branch); TIntList::const_iterator bei(mapping->begin() + branch->first), bee(mapping->begin() + branch->last); const int offset = (t - temp) - (branch->first - first); for(; bei != bee; *t++ = *bei++); if (offset) branch->recursiveMove(offset); } TIntList::iterator bei(mapping->begin() + first), bee(mapping->begin() + last); for(t = temp; bei!=bee; *bei++ = *t++); bi = branches->begin(); THierarchicalClusterList::const_iterator nbi(newBranches.begin()); for(; bi != be; *bi++ = *nbi++); }
void Bee::draw(){ beginDraw(); glTranslatef(O[0],O[1],O[2]); glRotatef(-rot * 36/2*M_PI,0,1,0); glTranslatef(r,h,0); bee(size); glTranslatef(-r,-h,0); glRotatef(rot * 36/2*M_PI,0,1,0); glTranslatef(-O[0],-O[1],-O[2]); endDraw(); }