Exemplo n.º 1
0
void Tube::resample(double new_deltaT) {
	IntervalVector temp = (*this);
	double ratio = new_deltaT/_deltaT;

	temp.resize((int)round((1/ratio)*(*this).size()));

	if(ratio<1){
		for(int i=0;i<temp.size();i++) {
			temp[i]=(*this)[(int)round(i*ratio)];
		}
	} else {
		for(int i=0;i<temp.size();i++) {
			temp[i]=Interval::EMPTY_SET;
			for(int j=0;j<ratio;j++) {
				temp[i]=temp[i]|(*this)[(i*ratio)+j];
			}
		}
	}

	(*this).resize((int)round((1/ratio)*(*this).size()));
	(*this) = temp;
	_deltaT = new_deltaT;
}