#include <vpsc/constraint.h>
#include <fstream>
#include <vpsc/blocks.h>
+#include <vector>
using std::ios;
using std::ofstream;
vs[i]=new Variable(i,0,1);
}
Constraint **cs;
- double *oldX = new double[n];
+ std::vector<double> oldX;
+ oldX.reserve(n);
int m=generateXConstraints(n,rs,vs,cs,true);
for(int i=0;i<n;i++) {
- oldX[i]=vs[i]->desiredPosition;
+ oldX.push_back(vs[i]->desiredPosition);
}
VPSC vpsc_x(n,vs,m,cs);
if (RECTANGLE_OVERLAP_LOGGING) {
rs[i]->moveCentreY(vs[i]->position());
rs[i]->moveCentreX(oldX[i]);
}
- delete [] oldX;
for(int i = 0; i < m; ++i) {
delete cs[i];
}