Exemple #1
0
	void Mesh::fixPlanarity(Vertex* vert) {
		vector<HalfEdge*> edgesToCheck;
		Face* f;
		HalfEdge* he;
		for (int i = 0; i < faces->size(); i++) {
			f = faces->at(i);
			he = f->first;
			while (true) {
				if (he->v == vert) {
					edgesToCheck.push_back(he);
					break;
				}
				if (he->next == f->first) {
					break;
				}
				he = he->next;
			}
		}
		for (int j = 0; j < edgesToCheck.size(); j++) {
			HalfEdge* toCheck = edgesToCheck.at(j);
			if (!toCheck->f->isPlanar()) {
				splitQuad(toCheck->next);
			}
		}
	}
void ViewportsSplitter::setViewportsLayout(ViewportPanel * vp, int index)
{
	switch (index)
	{
	case 0:
		splitSingle(vp);
		break;
	case 1:
		splitVertical(vp);
		break;
	case 2: 
		splitHorizontal(vp);
		break;
	case 3:
		split2Up1Down(vp);
		break;
	case 4:
		split1Up2Down(vp);
		break;
	case 5:
		splitQuad();
		break;
	}
	if (index<=5 && index>=0 && index != currentLayoutIndex)
	{
		currentLayoutIndex = index;
		emit indexLayoutChanged(index);
	}
}
ViewportsSplitter::ViewportsSplitter(QWidget * parent) 
	: QSplitter(Qt::Vertical, parent)	
{
    connect( &_timer, SIGNAL(timeout()), this, SLOT(update()) );
    _timer.start( 10 );
    
	first = new ViewportPanel(this);
	second = new ViewportPanel(this);
	third = new ViewportPanel(this);
	fourth = new ViewportPanel(this);
	dummy = new ViewportPanel(this);

	connect(this, SIGNAL(indexLayoutChanged(const int&)), first, SLOT(updateIndexLayout(const int&)));
	connect(this, SIGNAL(indexLayoutChanged(const int&)), second, SLOT(updateIndexLayout(const int&)));
	connect(this, SIGNAL(indexLayoutChanged(const int&)), third, SLOT(updateIndexLayout(const int&)));
	connect(this, SIGNAL(indexLayoutChanged(const int&)), fourth, SLOT(updateIndexLayout(const int&)));

	splitQuad();

	// add a dummy scene to the scene stack in order to 
	// avoid empty viewports if the scene-view panel is selected
	// before any scene is added to the node pipeline
	addScene(new osg::Group, "dummy");
    this->installEventFilter(this);
}
Exemple #4
0
void My3DViewer::setAztec(MyGLWidget* m){
	aztec=m;
	connect(splitQuad, SIGNAL(clicked()), aztec, SLOT(splitQuad()));
	connect(deleteVertex, SIGNAL(clicked()), aztec, SLOT(deleteVertex()));
	connect(insertEdge, SIGNAL(clicked()), aztec, SLOT(insertEdge()));
	connect(incrementSharpness, SIGNAL(clicked()), aztec, SLOT(incSharpness()));
	connect(decrementSharpness, SIGNAL(clicked()), aztec, SLOT(decSharpness()));
	connect(forcePlanarity, SIGNAL(clicked()), aztec, SLOT(toggleForcePlanarity()));
	connect(insertVertex, SIGNAL(clicked()), aztec, SLOT(insertVertex()));
	connect(smooth, SIGNAL(clicked()), aztec, SLOT(smooth()));
	connect(extrude, SIGNAL(clicked()), aztec, SLOT(extrude2()));

	connect(faceButton, SIGNAL(clicked()), aztec, SLOT(enterFaceMode()));
	connect(objectButton, SIGNAL(clicked()), aztec, SLOT(enterObjectMode()));
	connect(vertexButton, SIGNAL(clicked()), aztec, SLOT(enterVertexMode()));
	connect(edgeButton, SIGNAL(clicked()), aztec, SLOT(enterEdgeMode()));
	connect(cpButton, SIGNAL(clicked()), aztec, SLOT(enterCPMode()));

	connect(snapToFace, SIGNAL(clicked()), aztec, SLOT(snapToFace()));
	connect(snapToEdge, SIGNAL(clicked()), aztec, SLOT(snapToEdge()));
	connect(snapToVertex, SIGNAL(clicked()), aztec, SLOT(snapToVertex()));

	//Connect mouse move events
	connect(aztec, SIGNAL(sendMouseEvent(QMouseEvent*)), this, SLOT(moveEvent(QMouseEvent*)));

		//errors
	connect(aztec, SIGNAL(error(char*)), this, SLOT(throwError(char*)));
	
}
Exemple #5
0
	Face* Mesh::splitQuad(HalfEdge* HE0) {

		Face* FACE1 = HE0->f;
		FACE1->deselect();
		HE0 = FACE1->first;
		if (FACE1->numEdges() < 4) {
			return FACE1;
		}

		QString* q = new QString(QString::number(faces->size() + 1));
		Face* FACE2 = new Face(NULL, FACE1->color->x, FACE1->color->y, FACE1->color->z, q);

		HalfEdge* HEL = new HalfEdge();
		HalfEdge* HER = new HalfEdge();

		HEL->f = FACE1;
		HER->f = FACE2;
		FACE2->first = HER;

		HEL->sym = HER;
		HER->sym = HEL;

		HEL->v = HE0->next->next->v;
		HEL->next = HE0->next->next->next;
		HER->next = HE0->next;
		HER->next->next->next = HER;
		HE0->next = HEL;
		HER->v = HE0->v;

		halfedges->push_back(HEL);
		halfedges->push_back(HER);
		faces->push_back(FACE2);

		if (!FACE2->isPlanar()) {
			splitQuad(FACE2->first);
		}
		if (!FACE1->isPlanar()) {
			splitQuad(FACE1->first);
		}
		return FACE2;
	}