UniformGrid::UniformGrid(const std::list<Model>& models, const Point3D& minPoint, const Point3D& maxPoint, uint32_t sizeFactor) { sideLength = (int) std::cbrt((double) sizeFactor * models.size()); // Add some padding to avoid edge points double PADDING = 0.1; double minCoord = std::min({minPoint[0], minPoint[1], minPoint[2]}) - PADDING; double maxCoord = std::max({maxPoint[0], maxPoint[1], maxPoint[2]}) + PADDING; startPoint = Point3D(minCoord, minCoord, minCoord); double distance = maxCoord - minCoord; cellSize = distance / sideLength; cellSizeScaleMatrix = scaleMatrix(cellSize, cellSize, cellSize); gridSizeScaleMatrix = scaleMatrix(distance, distance, distance); cells.resize(sideLength * sideLength * sideLength); std::clock_t start = std::clock(); // Now we must populate the cells populateCells(models); std::cerr << "Populating time: " << (std::clock() - start) / (double)(CLOCKS_PER_SEC / 1000) << " ms" << std::endl; }
caChoice::caChoice(QWidget *parent) : QWidget(parent) { numCells = 2; labels << "1" << "2" << "3" << "4" << "5" << "6" << "7" << "8" << "9" << "10" << "11" << "12" << "13" << "14" << "15" << "16"; texts << "1" << "2" << "3" << "4" << "5" << "6" << "7" << "8" << "9" << "10" << "11" << "12" << "13" << "14" << "15" << "16"; signalMapper = new QSignalMapper(this); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); grid = new QGridLayout(this); grid->setMargin(0); grid->setSpacing(2); thisStacking = Row; thisStartBit = 0; thisEndBit = 15; thisColorMode = Default; thisForeColor = QColor(0,0,0); thisBackColor = QColor(155,255,255); thisBorderColor = QColor(0,0,176); thisAlignment = center; thisScaleMode = EPushButton::WidthAndHeight; setAccessW(true); installEventFilter(this); populateCells(labels, -1); setColorMode(thisColorMode); setElevation(on_top); }