MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); m_tree = new TreeWidgetMine(ui->treeWidget); initButtonName(); createToolBar(); crtUIActConnect(); scene = Scene::Instance(); ui->view->setScene(scene); //显示关系控制栏 //结点属性显示控制栏 connect(ui->attrButtonGroup, SIGNAL(buttonToggled(QAbstractButton*, bool)), this, SLOT(changShowFlag(QAbstractButton*, bool))); connect(this,SIGNAL(nodefilterSIG(QString,bool)),scene,SLOT(nodeFilter(QString,bool))); //connect(ui->attrButtonGroup,SIGNAL(buttonToggled(int,bool)),this,SLOT(changeRelationFlag(int,bool))); ui->moneyRelationBox->setChecked(true); ui->idRelationBox->setChecked(true); ui->addrBox->setChecked(true); ui->societyRealtionBox->setChecked(true); ui->IPBox->setChecked(true); ui->phoneBox->setChecked(true); ui->MacBox->setChecked(true); ui->ATMBox->setChecked(true); //分析控制栏 connect(ui->someNetBox, SIGNAL(clicked(bool)), ui->view, SLOT(drawNetBySomeone(bool))); connect(ui->linkerNumSpinBox, SIGNAL(valueChanged(int)), this, SLOT(showItemByLinkerNum(int))); connect(ui->topLevelColorBox, SIGNAL(clicked(bool)), this, SLOT(setTopLevelColor(bool))); connect(ui->fontSizeBox, SIGNAL(valueChanged(int)), this, SLOT(setFontSize(int))); connect(ui->findNodeBtn,SIGNAL(clicked()),this,SLOT(fixedPoint()));//定点寻址 connect(this,SIGNAL(routePointSIG(QString )),ui->view, SLOT(routePoint(QString))); //jaky, connect(ui->view,SIGNAL(showTreeWgt(ItemBase*)),this,SLOT(showInfo(ItemBase*))); connect(ui->nodeDisBOx, SIGNAL(valueChanged(int)), this,SLOT(setNodeInterval(int))); //状态栏信息更新 connect(scene, SIGNAL(sendMsg(QString)), this, SLOT(showBarMsg(QString))); connect(ui->view, SIGNAL(sendMsg(QString)), this, SLOT(showBarMsg(QString))); setWindowTitle("RiskKiller"); //ui->page_1->setStyleSheet("font:75 9pt Aharoni;"); ui->toolBox->setStyleSheet("QToolBox::tab:selected{font:12pt; color: rgb(2, 2, 124);}"); }
void Mobius::render() { Matrix ma = Matrix(); Matrix mb = Matrix(); // create the generator matrices using Grandma's recipie grandmasRecipie(complex<double>(_taReal, _taImaginary), complex<double>(_tbReal, _tbImaginary), ma, mb); Matrix mA = ma.inv(); Matrix mB = mb.inv(); // skip [0] to keep indices in line with Indra Pearls alogrithm gen[0] = ma; gen[1] = mb; gen[2] = mA; gen[3] = mB; char print[4] = {'a', 'b', 'A', 'B'}; // start at one of the fixed points oldPoint = fixedPoint(ma * mb * mA * mB); // parabolic array holds fixed points for infinite worlds parabolics[0][0] = fixedPoint(mb * mA * mB *ma); parabolics[0][1] = fixedPoint(ma); parabolics[0][2] = fixedPoint(mB * mA * mb * ma); parabolics[1][0] = fixedPoint(mA * mB * ma * mb); parabolics[1][1] = fixedPoint(mb); parabolics[1][2] = fixedPoint(ma * mB * mA * mb); parabolics[2][0] = fixedPoint(mB * ma * mb * mA); parabolics[2][1] = fixedPoint(mA); parabolics[2][2] = fixedPoint(mb * ma * mB * mA); parabolics[3][0] = fixedPoint(ma * mb * mA * mB); parabolics[3][1] = fixedPoint(mB); parabolics[3][2] = fixedPoint(mA * mb * ma * mB); tag[0]=0; word[0]=gen[0]; level=0; // cout << print[tag[level]] << endl; cout << "DEPTH: " << DEPTH << endl; _image = new QImage (_imageBuffer, _textureWidth, _textureHeight, _textureWidth*4 , QImage::Format_RGB32); _image->fill(0x00FFFFFF); QPainter painter (_image); painter.setRenderHint(QPainter::Antialiasing, true); int minLevel = DEPTH + 1; while(1==1) { // for(int loop = 1; loop < 1000000; loop++) { while(!(branchTermination(painter))) { level++; // tag[level] = ((tag[level-1] + 1) % 4 ); tag[level] = ((tag[level-1] + 1) & 3 ); word[level] = word[level-1] * gen[tag[level]]; } do { level--; } while( level >= 0 && (!availableTurn()) ); // tag[level+1] = ((tag[level+1] + 3) % 4) ; tag[level+1] = ((tag[level+1] + 3) & 3) ; if(tag[0]==0 && level < 0) { cout << "Finished" << endl; break; } if(level < 0) { word[0] = gen[tag[0]]; } else { word[level+1] = word[level] * gen[tag[level+1]]; ; } level++; } painter.end(); }
void FlemonsSpineModelGoal::setup(tgWorld& world) { // This is basically a manual setup of a model. // There are things that do this for us /// @todo: reference the things that do this for us // Rod and Muscle configuration // Note: This needs to be high enough or things fly apart... const double density = 4.2/300.0; const double radius = 0.5; const double friction = 0.5; const double rollFriction = 0.0; const double restitution = 0.0; const tgRod::Config rodConfig(radius, density, friction, rollFriction, restitution); const double elasticity = 1000.0; const double damping = 10.0; const double pretension = 0.0; const bool history = true; const double maxTens = 7000.0; const double maxSpeed = 12.0; const double mRad = 1.0; const double motorFriction = 10.0; const double motorInertia = 1.0; const bool backDrivable = false; tgKinematicActuator::Config motorConfig(elasticity, damping, pretension, mRad, motorFriction, motorInertia, backDrivable, history, maxTens, maxSpeed); // Calculations for the flemons spine model double v_size = 10.0; // Create the tetrahedra tgStructure tetra; tetra.addNode(0.0, 0.0, 0.0); // center tetra.addNode( v_size, v_size, v_size); // front tetra.addNode( v_size, -v_size, -v_size); // right tetra.addNode(-v_size, v_size, -v_size); // back tetra.addNode(-v_size, -v_size, v_size); // left tetra.addPair(0, 1, "front rod"); tetra.addPair(0, 2, "right rod"); tetra.addPair(0, 3, "back rod"); tetra.addPair(0, 4, "left rod"); // Move the first one so we can create a longer snake. // Or you could move the snake at the end, up to you. tetra.move(btVector3(0.0,15.0,50.0)); // Create our snake segments tgStructure snake; /// @todo: there seems to be an issue with Muscle2P connections if the front /// of a tetra is inside the next one. btVector3 offset(0.0, 0.0, -v_size * 1.15); for (std::size_t i = 0; i < m_segments; i++) { /// @todo: the snake is a temporary variable -- /// will its destructor be called? /// If not, where do we delete its children? tgStructure* const p = new tgStructure(tetra); p->addTags(tgString("segment num", i + 1)); p->move((i + 1.0) * offset); snake.addChild(p); // Add a child to the snake } //conditionally compile for debugging #if (1) // Add muscles that connect the segments // Tag the muscles with their segment numbers so CPGs can find // them. std::vector<tgStructure*> children = snake.getChildren(); for (std::size_t i = 1; i < children.size(); i++) { tgNodes n0 = children[i - 1]->getNodes(); tgNodes n1 = children[i]->getNodes(); snake.addPair(n0[1], n1[1], tgString("outer front muscle seg", i)); snake.addPair(n0[2], n1[2], tgString("outer right muscle seg", i)); snake.addPair(n0[3], n1[3], tgString("outer back muscle seg", i)); snake.addPair(n0[4], n1[4], tgString("outer top muscle seg", i)); snake.addPair(n0[2], n1[1], tgString("inner front muscle seg", i)); snake.addPair(n0[2], n1[4], tgString("inner right muscle seg", i)); snake.addPair(n0[3], n1[1], tgString("inner left muscle seg", i)); snake.addPair(n0[3], n1[4], tgString("inner back muscle seg", i)); } #endif btVector3 fixedPoint(0.0, 0.0, 0.0); btVector3 axis(0.0, 1.0, 0.0); snake.addRotation(fixedPoint, axis, m_startAngle); // Create the build spec that uses tags to turn the structure into a real model tgBuildSpec spec; spec.addBuilder("rod", new tgRodInfo(rodConfig)); #if (1) spec.addBuilder("muscle", new tgKinematicContactCableInfo(motorConfig)); #else spec.addBuilder("muscle", new tgBasicContactCableInfo(motorConfig)); #endif // Create your structureInfo tgStructureInfo structureInfo(snake, spec); // Use the structureInfo to build ourselves structureInfo.buildInto(*this, world); // Setup vectors for control m_allMuscles = tgCast::filter<tgModel, tgSpringCableActuator> (getDescendants()); m_allSegments = this->find<tgModel> ("segment"); //addMarkers(snake, *this, m_segments); #if (0) // Debug printing std::cout << "StructureInfo:" << std::endl; std::cout << structureInfo << std::endl; std::cout << "Model: " << std::endl; std::cout << *this << std::endl; std::cout << "Spine Length: " << getSpineLength() << std::endl; #endif std::vector<tgBaseRigid*> myRigids = this->getAllRigids(); #if (1) for (int i =0; i < myRigids.size(); i++) { std::cout << myRigids[i]->mass() << " " <<myRigids[i]->getPRigidBody() << std::endl; } #endif children.clear(); // Actually setup the children, notify controller BaseSpineModelGoal::setup(world); }
void ZoomPanElement::zoomOnPointInFrame(const Vector2d&point, double zoom) { Vector2d fixedPoint((point.x-contentOffset.x)/zoom, (point.y-contentOffset.y)/zoom); zoomOnPoint(fixedPoint, zoom); }
//! Solve the problem performing the fixed point scheme. virtual void solve () { fixedPoint (); }