X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Flibvpsc%2Fremove_rectangle_overlap.cpp;h=68af4c5c59de585c10d5ab175d166d43acf72c58;hb=6ec35538b3387ac72af1c9e921e531b75250f2d4;hp=6f6ace03ae0e88af16cc157dd91eb95071aa718c;hpb=1ec681f88b68c6186b267afcce12c7fd667cc9f8;p=inkscape.git diff --git a/src/libvpsc/remove_rectangle_overlap.cpp b/src/libvpsc/remove_rectangle_overlap.cpp index 6f6ace03a..68af4c5c5 100644 --- a/src/libvpsc/remove_rectangle_overlap.cpp +++ b/src/libvpsc/remove_rectangle_overlap.cpp @@ -24,6 +24,7 @@ using std::endl; #endif #define EXTRA_GAP 0.0001 +using namespace vpsc; double Rectangle::xBorder=0; double Rectangle::yBorder=0; @@ -40,32 +41,31 @@ double Rectangle::yBorder=0; * too much in the first pass. */ void removeRectangleOverlap(unsigned n, Rectangle *rs[], double xBorder, double yBorder) { - assert(0 <= n); try { // The extra gap avoids numerical imprecision problems Rectangle::setXBorder(xBorder+EXTRA_GAP); Rectangle::setYBorder(yBorder+EXTRA_GAP); Variable **vs=new Variable*[n]; - for(int i=0;idesiredPosition; } - VPSC vpsc_x(n,vs,m,cs); + Solver vpsc_x(n,vs,m,cs); #ifdef RECTANGLE_OVERLAP_LOGGING ofstream f(LOGFILE,ios::app); f<<"Calling VPSC: Horizontal pass 1"<moveCentreX(vs[i]->position()); } - for(int i = 0; i < m; ++i) { + for(unsigned i = 0; i < m; ++i) { delete cs[i]; } delete [] cs; @@ -73,43 +73,43 @@ void removeRectangleOverlap(unsigned n, Rectangle *rs[], double xBorder, double // one another above are not considered overlapping Rectangle::setXBorder(Rectangle::xBorder-EXTRA_GAP); m=generateYConstraints(n,rs,vs,cs); - VPSC vpsc_y(n,vs,m,cs); + Solver vpsc_y(n,vs,m,cs); #ifdef RECTANGLE_OVERLAP_LOGGING f.open(LOGFILE,ios::app); f<<"Calling VPSC: Vertical pass"<moveCentreY(vs[i]->position()); rs[i]->moveCentreX(oldX[i]); } delete [] oldX; - for(int i = 0; i < m; ++i) { + for(unsigned i = 0; i < m; ++i) { delete cs[i]; } delete [] cs; Rectangle::setYBorder(Rectangle::yBorder-EXTRA_GAP); m=generateXConstraints(n,rs,vs,cs,false); - VPSC vpsc_x2(n,vs,m,cs); + Solver vpsc_x2(n,vs,m,cs); #ifdef RECTANGLE_OVERLAP_LOGGING f.open(LOGFILE,ios::app); f<<"Calling VPSC: Horizontal pass 2"<moveCentreX(vs[i]->position()); delete vs[i]; } delete [] vs; } catch (char const *str) { std::cerr<