double DLibshuff::dCalculate(int x, int y){ double sum = 0; minX = getMinX(x); if (m->control_pressed) { return sum; } minXY = getMinXY(x, y); if (m->control_pressed) { return sum; } vector<int> nx = calcN(minX); if (m->control_pressed) { return sum; } vector<int> nxy = calcN(minXY); if (m->control_pressed) { return sum; } for(int i=0;i<numDXs;i++){ float h = (nx[i] - nxy[i]) / (float) groupSizes[x]; sum += h * h * stepSize; } return sum; }
/** * gets the size of a bounding box of a quad */ vector getSize(quadri q) { vector siz, minXY = getMinXY(q), maxXY = getMaxXY(q); siz.x = maxXY.x-minXY.x; siz.y = maxXY.y-minXY.y; siz.z = 0.0; return siz; }
/** * gets the midpoint of a bounding box of a quad */ vector getMidPoint(quadri q) { vector mid, minXY = getMinXY(q), maxXY = getMaxXY(q); mid.x = 0.5*(minXY.x+maxXY.x); mid.y = 0.5*(minXY.y+maxXY.y); mid.z = 0.0; return mid; }