#include #include using std::vector; void Detection::SortByZ() { /** * Detection::SortByZ(): * A Function that takes a Detection and * sorts the pixels by z-pixel * Upon return, the inputList is sorted. */ long size = this->pix.size(); float *positions = new float[size]; float *z = new float[size]; for(int i=0;ipix[i].getZ(); } sort(z, positions, 0, size); vector sorted(size); for(int i=0;ipix[ int(positions[i]) ] ; delete [] positions; delete [] z; for(int i=0;ipix.erase(this->pix.begin()+i); this->pix.insert(this->pix.begin()+i, sorted[i]); } sorted.clear(); } /** * SortByZ(vector &): * A Function that takes a list of Detections and * sorts them in order of increasing z-pixel value. * Upon return, the inputList is sorted. */ void SortByZ(vector &inputList) { long size = inputList.size(); float *positions = new float[size]; float *z = new float[size]; for(int i=0;igetZcentre(); delete obj; } sort(z, positions, 0, size); vector sorted; for(int i=0;i &): * A Function that takes a list of Detections and * sorts them in order of increasing velocity. * Every member of the vector needs to have WCS defined, (and if so, * then vel is assumed to be defined for all), otherwise no sorting * is done. * Upon return (if all WCS are good), the inputList is sorted. */ void SortByVel(vector &inputList) { bool isGood = true; for(int i=0;igetVel(); delete obj; } sort(vel, positions, 0, size); vector sorted; for(int i=0;i