Post constraint on \a xwyh
| 152 | } |
| 153 | /// Post constraint on \a xwyh |
| 154 | virtual void post(Gecode::Space& home, Gecode::IntVarArray& xwyh) { |
| 155 | using namespace Gecode; |
| 156 | int n = xwyh.size() / 4; |
| 157 | IntVarArgs x0(n), w(n), x1(n), y0(n), h(n), y1(n); |
| 158 | for (int i=0; i<n; i++) { |
| 159 | x0[i]=xwyh[4*i+0]; w[i]=xwyh[4*i+1]; |
| 160 | x1[i]=expr(home, x0[i] + w[i]); |
| 161 | y0[i]=xwyh[4*i+2]; h[i]=xwyh[4*i+3]; |
| 162 | y1[i]=expr(home, y0[i] + h[i]); |
| 163 | } |
| 164 | nooverlap(home, x0, w, x1, y0, h, y1); |
| 165 | } |
| 166 | }; |
| 167 | |
| 168 | /// %Test for no-overlap with optional rectangles |